You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.en.md
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -100,27 +100,37 @@ for your error, you must both navigate back to the correct location and relocate
100
100
101
101
## ElementClickInterceptedException
102
102
103
-
This exception occurs when Selenium tries to click an element, but the click would instead be received by a different element. Before Selenium will click an element, it checks if the element is visible, unobscured by any other elements, and enabled - if the element is obscured, it will raise this exception.
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.
104
106
105
107
### Likely Cause
106
108
107
109
**UI Elements Overlapping**
108
110
109
-
Elements on the UI are typically placed next to each other, but occasionally elements may overlap. For example, a navbar always staying at the top of your window as you scroll a page. If that navbar happens to be covering an element we are trying to click, Selenium might believe it to be visible and enabled, but when you try to click it will throw this exception. Pop-ups and Modals are also common offenders here.
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.
110
115
111
116
**Animations**
112
117
113
-
Elements with animations have the potential to cause this exception as well - it is recommended to wait for animations to cease before attempting to click an element.
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.
114
120
115
121
### Possible Solutions
116
122
117
123
**Use Explicit Waits**
118
124
119
-
Explicit waits will likely be your best friend in these instances. A great way is to use `ExpectedCondition.ToBeClickable()` with `WebDriverWait` to wait until the right moment.
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.
120
127
121
128
**Scroll the Element into View**
122
129
123
-
In instances where the element is out of view, but Selenium still registers the element as visible (e.g. navbars overlapping a section at the top of your screen), you can use the `WebDriver.executeScript()` method to execute a javascript function to scroll (e.g. `WebDriver.executeScript('window.scrollBy(0,-250)')`) or you can utilize the Actions class with `Actions.moveToElement(element)`.
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)`.
0 commit comments