From c906c7440d5e729689beff9ddeacf49b21a69044 Mon Sep 17 00:00:00 2001 From: Simon Benzer Date: Wed, 28 Aug 2024 20:43:17 -0400 Subject: [PATCH 1/7] removed hanging badge code --- .../documentation/webdriver/getting_started/using_selenium.en.md | 1 - .../documentation/webdriver/getting_started/using_selenium.ja.md | 1 - .../webdriver/getting_started/using_selenium.pt-br.md | 1 - .../webdriver/getting_started/using_selenium.zh-cn.md | 1 - 4 files changed, 4 deletions(-) diff --git a/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.en.md b/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.en.md index ed89a4292042..59b8c5075712 100644 --- a/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.en.md +++ b/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.en.md @@ -232,7 +232,6 @@ gradle clean test {{% /tab %}} {{% tab header="Python" %}} {{< gh-codeblock path="examples/python/README.md#L35" >}} -{{< badge-code >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.ja.md b/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.ja.md index 2b538ea5043e..9c3ff5504c5c 100644 --- a/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.ja.md +++ b/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.ja.md @@ -228,7 +228,6 @@ gradle clean test {{% /tab %}} {{% tab header="Python" %}} {{< gh-codeblock path="examples/python/README.md#L35" >}} -{{< badge-code >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.pt-br.md b/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.pt-br.md index deac879f22dc..c5049a916409 100644 --- a/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.pt-br.md @@ -228,7 +228,6 @@ gradle clean test {{% /tab %}} {{% tab header="Python" %}} {{< gh-codeblock path="examples/python/README.md#L35" >}} -{{< badge-code >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.zh-cn.md b/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.zh-cn.md index 2d16336a15c4..45455718372d 100644 --- a/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/getting_started/using_selenium.zh-cn.md @@ -212,7 +212,6 @@ gradle clean test {{% /tab %}} {{% tab header="Python" %}} {{< gh-codeblock path="examples/python/README.md#L35" >}} -{{< badge-code >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} From d0d48c82d007dbb374d4984664194cd2cc3115c4 Mon Sep 17 00:00:00 2001 From: Simon Benzer Date: Thu, 29 Aug 2024 18:19:26 -0400 Subject: [PATCH 2/7] added ElementClickInterceptedException to all languages --- .../troubleshooting/errors/_index.en.md | 28 +++++++++++++++++-- .../troubleshooting/errors/_index.ja.md | 28 +++++++++++++++++-- .../troubleshooting/errors/_index.pt-br.md | 28 +++++++++++++++++-- .../troubleshooting/errors/_index.zh-cn.md | 24 ++++++++++++++++ 4 files changed, 102 insertions(+), 6 deletions(-) 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..7ce580bc448c 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,6 +98,30 @@ 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 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.ja.md b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.ja.md index 17f3179eb5ed..cb47100ea039 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,6 +92,30 @@ 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 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.pt-br.md b/website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.pt-br.md index 17f3179eb5ed..cb47100ea039 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,30 @@ 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 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..4843674e9894 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,30 @@ 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 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 异常 有时您尝试访问的会话与当前可用的会话不同。 From 615e688b4a9c604c540b30db7a90b9d83b1ab18a Mon Sep 17 00:00:00 2001 From: Simon Benzer <69980130+shbenzer@users.noreply.github.com> Date: Wed, 11 Sep 2024 22:50:38 -0400 Subject: [PATCH 3/7] reduced line count, added reference --- .../troubleshooting/errors/_index.en.md | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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 7ce580bc448c..98dbd4f8f16e 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 @@ -100,27 +100,37 @@ for your error, you must both navigate back to the correct location and relocate ## 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. +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. +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. +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 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. +[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)`. +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 From d617794bc9af460d153b5ddbf5a02521d47cc956 Mon Sep 17 00:00:00 2001 From: Simon Benzer <69980130+shbenzer@users.noreply.github.com> Date: Wed, 11 Sep 2024 22:51:33 -0400 Subject: [PATCH 4/7] Update _index.ja.md --- .../troubleshooting/errors/_index.ja.md | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) 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 cb47100ea039..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 @@ -94,27 +94,39 @@ for your error, you must both navigate back to the correct location and relocate ## 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. +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. +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. +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 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. +[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)`. +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 @@ -122,8 +134,10 @@ Sometimes the session you're trying to access is different than what's currently ### 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. From ff6eda3b278913c3e6b837e486bc5ddfed823e65 Mon Sep 17 00:00:00 2001 From: Simon Benzer <69980130+shbenzer@users.noreply.github.com> Date: Wed, 11 Sep 2024 22:52:39 -0400 Subject: [PATCH 5/7] Update _index.pt-br.md --- .../troubleshooting/errors/_index.pt-br.md | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) 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 cb47100ea039..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 @@ -94,27 +94,41 @@ for your error, you must both navigate back to the correct location and relocate ## 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. +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. +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. +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 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. +[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)`. +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 From 466cd889e32e1d2d6bef6599d4d5a85c406567f7 Mon Sep 17 00:00:00 2001 From: Simon Benzer <69980130+shbenzer@users.noreply.github.com> Date: Wed, 11 Sep 2024 22:53:36 -0400 Subject: [PATCH 6/7] Update _index.zh-cn.md --- .../troubleshooting/errors/_index.zh-cn.md | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) 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 4843674e9894..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 @@ -101,27 +101,41 @@ 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. +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. +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. +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 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. +[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)`. +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 异常 有时您尝试访问的会话与当前可用的会话不同。 From 5b838b4e1cefe1da2e70b5088931c5d1f36d37a4 Mon Sep 17 00:00:00 2001 From: Simon Benzer <69980130+shbenzer@users.noreply.github.com> Date: Wed, 11 Sep 2024 22:53:55 -0400 Subject: [PATCH 7/7] Update _index.en.md --- .../webdriver/troubleshooting/errors/_index.en.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 98dbd4f8f16e..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 @@ -138,8 +138,10 @@ Sometimes the session you're trying to access is different than what's currently ### 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.