diff --git a/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.en.md b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.en.md index 32aee5a1714f..5d675125e850 100644 --- a/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.en.md +++ b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.en.md @@ -53,7 +53,7 @@ Elements do not get relocated automatically; the driver creates a reference ID f has a particular place it expects to find it in the DOM. If it can not find the element in the current DOM, any action using that element will result in this exception. -### Common Causes +### Likely Cause This can happen when: @@ -61,7 +61,7 @@ This can happen when: * You have navigated to a different page. * You have switched to another window or into or out of a frame or iframe. -### Common Solutions +### Possible Solutions **The DOM has changed** @@ -98,14 +98,50 @@ You can't just relocate it from the current context, and you can't switch back to an active context where it is valid. If this is the reason for your error, you must both navigate back to the correct location and relocate it. +## ElementClickInterceptedException + +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. + +### Likely Cause + +**UI Elements Overlapping** + +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. + +**Animations** + +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. + +### Possible Solutions + +**Use Explicit Waits** + +[Explicit Waits]({{< ref "/documentation/webdriver/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. + +**Scroll the Element into View** + +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)`. + ## Invalid SessionId Exception Sometimes the session you're trying to access is different than what's currently available ### Likely Cause -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()`) +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()`) ### Possible Solutions -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. +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. diff --git a/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.ja.md b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.ja.md index 17f3179eb5ed..7e9c9709d67b 100644 --- a/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.ja.md +++ b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.ja.md @@ -47,7 +47,7 @@ Elements do not get relocated automatically; the driver creates a reference ID f has a particular place it expects to find it in the DOM. If it can not find the element in the current DOM, any action using that element will result in this exception. -### Common Causes +### Likely Cause This can happen when: @@ -55,7 +55,7 @@ This can happen when: * You have navigated to a different page. * You have switched to another window or into or out of a frame or iframe. -### Common Solutions +### Possible Solutions **The DOM has changed** @@ -92,14 +92,52 @@ You can't just relocate it from the current context, and you can't switch back to an active context where it is valid. If this is the reason for your error, you must both navigate back to the correct location and relocate it. +## ElementClickInterceptedException + +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. + +### Likely Cause + +**UI Elements Overlapping** + +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. + +**Animations** + +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. + +### Possible Solutions + +**Use Explicit Waits** + +[Explicit Waits]({{< ref "/documentation/webdriver/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. + +**Scroll the Element into View** + +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)`. + ## Invalid SessionId Exception Sometimes the session you're trying to access is different than what's currently available ### Likely Cause -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()`) +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()`) ### Possible Solutions -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. +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. diff --git a/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.pt-br.md b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.pt-br.md index 17f3179eb5ed..571b54e61f76 100644 --- a/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.pt-br.md @@ -47,7 +47,7 @@ Elements do not get relocated automatically; the driver creates a reference ID f has a particular place it expects to find it in the DOM. If it can not find the element in the current DOM, any action using that element will result in this exception. -### Common Causes +### Likely Cause This can happen when: @@ -55,7 +55,7 @@ This can happen when: * You have navigated to a different page. * You have switched to another window or into or out of a frame or iframe. -### Common Solutions +### Possible Solutions **The DOM has changed** @@ -92,6 +92,44 @@ You can't just relocate it from the current context, and you can't switch back to an active context where it is valid. If this is the reason for your error, you must both navigate back to the correct location and relocate it. +## ElementClickInterceptedException + +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. + +### Likely Cause + +**UI Elements Overlapping** + +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. + +**Animations** + +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. + +### Possible Solutions + +**Use Explicit Waits** + +[Explicit Waits]({{< ref "/documentation/webdriver/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. + +**Scroll the Element into View** + +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)`. + ## Invalid SessionId Exception Sometimes the session you're trying to access is different than what's currently available diff --git a/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.zh-cn.md b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.zh-cn.md index d570d3b82aa3..b88ec8355af3 100644 --- a/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.zh-cn.md @@ -99,6 +99,44 @@ WebDriver并不会自动重新定位, 如果这是您的错误原因, 您必须回到正确的位置并重新定位元素。 +## ElementClickInterceptedException + +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. + +### Likely Cause + +**UI Elements Overlapping** + +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. + +**Animations** + +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. + +### Possible Solutions + +**Use Explicit Waits** + +[Explicit Waits]({{< ref "/documentation/webdriver/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. + +**Scroll the Element into View** + +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)`. + ## 无效 SessionId 异常 有时您尝试访问的会话与当前可用的会话不同。