Skip to content

Commit 799d3c4

Browse files
shbenzerharsha509
andauthored
Added ElementClickInterceptedException to all languages (#1914)[deploy site]
* removed hanging badge code * added ElementClickInterceptedException to all languages * reduced line count, added reference * Update _index.ja.md * Update _index.pt-br.md * Update _index.zh-cn.md * Update _index.en.md --------- Co-authored-by: Sri Harsha <[email protected]>
1 parent 314fb76 commit 799d3c4

File tree

4 files changed

+160
-10
lines changed

4 files changed

+160
-10
lines changed

Diff for: website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.en.md

+40-4
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ Elements do not get relocated automatically; the driver creates a reference ID f
5353
has a particular place it expects to find it in the DOM. If it can not find the element
5454
in the current DOM, any action using that element will result in this exception.
5555

56-
### Common Causes
56+
### Likely Cause
5757

5858
This can happen when:
5959

6060
* You have refreshed the page, or the DOM of the page has dynamically changed.
6161
* You have navigated to a different page.
6262
* You have switched to another window or into or out of a frame or iframe.
6363

64-
### Common Solutions
64+
### Possible Solutions
6565

6666
**The DOM has changed**
6767

@@ -98,14 +98,50 @@ You can't just relocate it from the current context,
9898
and you can't switch back to an active context where it is valid. If this is the reason
9999
for your error, you must both navigate back to the correct location and relocate it.
100100

101+
## ElementClickInterceptedException
102+
103+
This exception occurs when Selenium tries to click an element, but the click would instead be received
104+
by a different element. Before Selenium will click an element, it checks if the element is visible,
105+
unobscured by any other elements, and enabled - if the element is obscured, it will raise this exception.
106+
107+
### Likely Cause
108+
109+
**UI Elements Overlapping**
110+
111+
Elements on the UI are typically placed next to each other, but occasionally elements may overlap. For example,
112+
a navbar always staying at the top of your window as you scroll a page. If that navbar happens to be covering
113+
an element we are trying to click, Selenium might believe it to be visible and enabled, but when you try to click
114+
it will throw this exception. Pop-ups and Modals are also common offenders here.
115+
116+
**Animations**
117+
118+
Elements with animations have the potential to cause this exception as well - it is recommended to wait for
119+
animations to cease before attempting to click an element.
120+
121+
### Possible Solutions
122+
123+
**Use Explicit Waits**
124+
125+
[Explicit Waits]({{< ref "/documentation/webdriver/waits" >}}) will likely be your best friend in these instances.
126+
A great way is to use `ExpectedCondition.ToBeClickable()` with `WebDriverWait` to wait until the right moment.
127+
128+
**Scroll the Element into View**
129+
130+
In instances where the element is out of view, but Selenium still registers the element as visible
131+
(e.g. navbars overlapping a section at the top of your screen), you can use the `WebDriver.executeScript()`
132+
method to execute a javascript function to scroll (e.g. `WebDriver.executeScript('window.scrollBy(0,-250)')`)
133+
or you can utilize the Actions class with `Actions.moveToElement(element)`.
134+
101135
## Invalid SessionId Exception
102136

103137
Sometimes the session you're trying to access is different than what's currently available
104138

105139
### Likely Cause
106140

107-
This usually occurs when the session has been deleted (e.g. `driver.quit()`) or if the session has changed, like when the last tab/browser has closed (e.g. `driver.close()`)
141+
This usually occurs when the session has been deleted (e.g. `driver.quit()`) or if the session has changed,
142+
like when the last tab/browser has closed (e.g. `driver.close()`)
108143

109144
### Possible Solutions
110145

111-
Check your script for instances of `driver.close()` and `driver.quit()`, and any other possible causes of closed tabs/browsers. It could be that you are locating an element before you should/can.
146+
Check your script for instances of `driver.close()` and `driver.quit()`, and any other possible causes
147+
of closed tabs/browsers. It could be that you are locating an element before you should/can.

Diff for: website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.ja.md

+42-4
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ Elements do not get relocated automatically; the driver creates a reference ID f
4747
has a particular place it expects to find it in the DOM. If it can not find the element
4848
in the current DOM, any action using that element will result in this exception.
4949

50-
### Common Causes
50+
### Likely Cause
5151

5252
This can happen when:
5353

5454
* You have refreshed the page, or the DOM of the page has dynamically changed.
5555
* You have navigated to a different page.
5656
* You have switched to another window or into or out of a frame or iframe.
5757

58-
### Common Solutions
58+
### Possible Solutions
5959

6060
**The DOM has changed**
6161

@@ -92,14 +92,52 @@ You can't just relocate it from the current context,
9292
and you can't switch back to an active context where it is valid. If this is the reason
9393
for your error, you must both navigate back to the correct location and relocate it.
9494

95+
## ElementClickInterceptedException
96+
97+
This exception occurs when Selenium tries to click an element, but the click would instead
98+
be received by a different element. Before Selenium will click an element, it checks if the
99+
element is visible, unobscured by any other elements, and enabled - if the element is obscured,
100+
it will raise this exception.
101+
102+
### Likely Cause
103+
104+
**UI Elements Overlapping**
105+
106+
Elements on the UI are typically placed next to each other, but occasionally elements may overlap.
107+
For example, a navbar always staying at the top of your window as you scroll a page. If that navbar
108+
happens to be covering an element we are trying to click, Selenium might believe it to be visible
109+
and enabled, but when you try to click it will throw this exception. Pop-ups and Modals are also
110+
common offenders here.
111+
112+
**Animations**
113+
114+
Elements with animations have the potential to cause this exception as well - it is recommended to
115+
wait for animations to cease before attempting to click an element.
116+
117+
### Possible Solutions
118+
119+
**Use Explicit Waits**
120+
121+
[Explicit Waits]({{< ref "/documentation/webdriver/waits" >}}) will likely be your best friend in these instances.
122+
A great way is to use `ExpectedCondition.ToBeClickable()` with `WebDriverWait` to wait until the right moment.
123+
124+
**Scroll the Element into View**
125+
126+
In instances where the element is out of view, but Selenium still registers the element as visible
127+
(e.g. navbars overlapping a section at the top of your screen), you can use the `WebDriver.executeScript()`
128+
method to execute a javascript function to scroll (e.g. `WebDriver.executeScript('window.scrollBy(0,-250)')`)
129+
or you can utilize the Actions class with `Actions.moveToElement(element)`.
130+
95131
## Invalid SessionId Exception
96132

97133
Sometimes the session you're trying to access is different than what's currently available
98134

99135
### Likely Cause
100136

101-
This usually occurs when the session has been deleted (e.g. `driver.quit()`) or if the session has changed, like when the last tab/browser has closed (e.g. `driver.close()`)
137+
This usually occurs when the session has been deleted (e.g. `driver.quit()`) or if the session has changed,
138+
like when the last tab/browser has closed (e.g. `driver.close()`)
102139

103140
### Possible Solutions
104141

105-
Check your script for instances of `driver.close()` and `driver.quit()`, and any other possible causes of closed tabs/browsers. It could be that you are locating an element before you should/can.
142+
Check your script for instances of `driver.close()` and `driver.quit()`, and any other possible causes of closed
143+
tabs/browsers. It could be that you are locating an element before you should/can.

Diff for: website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.pt-br.md

+40-2
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ Elements do not get relocated automatically; the driver creates a reference ID f
4747
has a particular place it expects to find it in the DOM. If it can not find the element
4848
in the current DOM, any action using that element will result in this exception.
4949

50-
### Common Causes
50+
### Likely Cause
5151

5252
This can happen when:
5353

5454
* You have refreshed the page, or the DOM of the page has dynamically changed.
5555
* You have navigated to a different page.
5656
* You have switched to another window or into or out of a frame or iframe.
5757

58-
### Common Solutions
58+
### Possible Solutions
5959

6060
**The DOM has changed**
6161

@@ -92,6 +92,44 @@ You can't just relocate it from the current context,
9292
and you can't switch back to an active context where it is valid. If this is the reason
9393
for your error, you must both navigate back to the correct location and relocate it.
9494

95+
## ElementClickInterceptedException
96+
97+
This exception occurs when Selenium tries to click an element, but the click would instead
98+
be received by a different element. Before Selenium will click an element, it checks if the
99+
element is visible, unobscured by any other elements, and enabled - if the element is obscured,
100+
it will raise this exception.
101+
102+
### Likely Cause
103+
104+
**UI Elements Overlapping**
105+
106+
Elements on the UI are typically placed next to each other, but occasionally elements may overlap.
107+
For example, a navbar always staying at the top of your window as you scroll a page. If that navbar
108+
happens to be covering an element we are trying to click, Selenium might believe it to be visible
109+
and enabled, but when you try to click it will throw this exception. Pop-ups and Modals are also
110+
common offenders here.
111+
112+
**Animations**
113+
114+
Elements with animations have the potential to cause this exception as well - it is recommended
115+
to wait for animations to cease before attempting to click an element.
116+
117+
### Possible Solutions
118+
119+
**Use Explicit Waits**
120+
121+
[Explicit Waits]({{< ref "/documentation/webdriver/waits" >}}) will likely be your best friend in these instances.
122+
A great way is to use `ExpectedCondition.ToBeClickable()` with `WebDriverWait`
123+
to wait until the right moment.
124+
125+
**Scroll the Element into View**
126+
127+
In instances where the element is out of view, but Selenium still registers the element as visible
128+
(e.g. navbars overlapping a section at the top of your screen), you can use the
129+
`WebDriver.executeScript()` method to execute a javascript function to scroll
130+
(e.g. `WebDriver.executeScript('window.scrollBy(0,-250)')`) or you can utilize the Actions
131+
class with `Actions.moveToElement(element)`.
132+
95133
## Invalid SessionId Exception
96134

97135
Sometimes the session you're trying to access is different than what's currently available

Diff for: website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.zh-cn.md

+38
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,44 @@ WebDriver并不会自动重新定位,
9999
如果这是您的错误原因,
100100
您必须回到正确的位置并重新定位元素。
101101

102+
## ElementClickInterceptedException
103+
104+
This exception occurs when Selenium tries to click an element, but the click would instead
105+
be received by a different element. Before Selenium will click an element, it checks if the
106+
element is visible, unobscured by any other elements, and enabled - if the element is obscured,
107+
it will raise this exception.
108+
109+
### Likely Cause
110+
111+
**UI Elements Overlapping**
112+
113+
Elements on the UI are typically placed next to each other, but occasionally elements may overlap.
114+
For example, a navbar always staying at the top of your window as you scroll a page. If that navbar
115+
happens to be covering an element we are trying to click, Selenium might believe it to be visible
116+
and enabled, but when you try to click it will throw this exception. Pop-ups and Modals are also
117+
common offenders here.
118+
119+
**Animations**
120+
121+
Elements with animations have the potential to cause this exception as well - it is recommended
122+
to wait for animations to cease before attempting to click an element.
123+
124+
### Possible Solutions
125+
126+
**Use Explicit Waits**
127+
128+
[Explicit Waits]({{< ref "/documentation/webdriver/waits" >}}) will likely be your best friend
129+
in these instances. A great way is to use `ExpectedCondition.ToBeClickable()`
130+
with `WebDriverWait` to wait until the right moment.
131+
132+
**Scroll the Element into View**
133+
134+
In instances where the element is out of view, but Selenium still registers the element as visible
135+
(e.g. navbars overlapping a section at the top of your screen), you can use the
136+
`WebDriver.executeScript()` method to execute a javascript function to scroll
137+
(e.g. `WebDriver.executeScript('window.scrollBy(0,-250)')`) or you can utilize the
138+
Actions class with `Actions.moveToElement(element)`.
139+
102140
## 无效 SessionId 异常
103141
有时您尝试访问的会话与当前可用的会话不同。
104142

0 commit comments

Comments
 (0)