Skip to content

Commit 615e688

Browse files
authored
reduced line count, added reference
1 parent 5289c18 commit 615e688

File tree

1 file changed

+15
-5
lines changed
  • website_and_docs/content/documentation/webdriver/troubleshooting/errors

1 file changed

+15
-5
lines changed

website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.en.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,37 @@ for your error, you must both navigate back to the correct location and relocate
100100

101101
## ElementClickInterceptedException
102102

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.
104106

105107
### Likely Cause
106108

107109
**UI Elements Overlapping**
108110

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.
110115

111116
**Animations**
112117

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.
114120

115121
### Possible Solutions
116122

117123
**Use Explicit Waits**
118124

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.
120127

121128
**Scroll the Element into View**
122129

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)`.
124134

125135
## Invalid SessionId Exception
126136

0 commit comments

Comments
 (0)