Skip to content

Commit 8b9fc2c

Browse files
authored
Add Documentation for ElementNotInteractableException in "Troubleshooting Errors" Section (#2120)
Add documentation for ElementNotInteractableException in troubleshooting errors
1 parent 1a80c1e commit 8b9fc2c

File tree

4 files changed

+67
-1
lines changed

4 files changed

+67
-1
lines changed

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

+16
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,19 @@ This exception occurs when the WebDriver is unable to create a new session for t
163163
- On macOS, go to **System Settings > Privacy & Security**, and allow the driver to run if blocked.
164164
- Verify the driver binary is executable (`chmod +x /path/to/driver` on Linux/macOS).
165165

166+
## ElementNotInteractableException
167+
168+
This exception occurs when Selenium tries to interact with an element that is not interactable in its current state.
169+
170+
### Likely Cause
171+
172+
1. **Unsupported Operation**: Performing an action, like `sendKeys`, on an element that doesn’t support it (e.g., `<form>` or `<label>`).
173+
2. **Multiple Elements Matching Locator**: The locator targets a non-interactable element, such as a `<td>` tag, instead of the intended `<input>` field.
174+
3. **Hidden Elements**: The element is present in the DOM but not visible on the page due to CSS, the `hidden` attribute, or being outside the visible viewport.
175+
176+
### Possible Solutions
177+
178+
1. Use actions appropriate for the element type (e.g., use `sendKeys` with `<input>` fields only).
179+
2. Ensure locators uniquely identify the intended element to avoid incorrect matches.
180+
3. Check if the element is visible on the page before interacting with it. Use scrolling to bring the element into view, if required.
181+
4. Use explicit waits to ensure the element is interactable before performing actions.

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

+18-1
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,21 @@ This exception occurs when the WebDriver is unable to create a new session for t
157157

158158
- Ensure the WebDriver version matches the browser version. For Chrome, check the browser version at `chrome://settings/help` and download the matching driver from [ChromeDriver Downloads](https://chromedriver.chromium.org/downloads).
159159
- On macOS, go to **System Settings > Privacy & Security**, and allow the driver to run if blocked.
160-
- Verify the driver binary is executable (`chmod +x /path/to/driver` on Linux/macOS).
160+
- Verify the driver binary is executable (`chmod +x /path/to/driver` on Linux/macOS).
161+
162+
## ElementNotInteractableException
163+
164+
This exception occurs when Selenium tries to interact with an element that is not interactable in its current state.
165+
166+
### Likely Cause
167+
168+
1. **Unsupported Operation**: Performing an action, like `sendKeys`, on an element that doesn’t support it (e.g., `<form>` or `<label>`).
169+
2. **Multiple Elements Matching Locator**: The locator targets a non-interactable element, such as a `<td>` tag, instead of the intended `<input>` field.
170+
3. **Hidden Elements**: The element is present in the DOM but not visible on the page due to CSS, the `hidden` attribute, or being outside the visible viewport.
171+
172+
### Possible Solutions
173+
174+
1. Use actions appropriate for the element type (e.g., use `sendKeys` with `<input>` fields only).
175+
2. Ensure locators uniquely identify the intended element to avoid incorrect matches.
176+
3. Check if the element is visible on the page before interacting with it. Use scrolling to bring the element into view, if required.
177+
4. Use explicit waits to ensure the element is interactable before performing actions.

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

+16
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,19 @@ This exception occurs when the WebDriver is unable to create a new session for t
159159
- On macOS, go to **System Settings > Privacy & Security**, and allow the driver to run if blocked.
160160
- Verify the driver binary is executable (`chmod +x /path/to/driver` on Linux/macOS).
161161

162+
## ElementNotInteractableException
163+
164+
This exception occurs when Selenium tries to interact with an element that is not interactable in its current state.
165+
166+
### Likely Cause
167+
168+
1. **Unsupported Operation**: Performing an action, like `sendKeys`, on an element that doesn’t support it (e.g., `<form>` or `<label>`).
169+
2. **Multiple Elements Matching Locator**: The locator targets a non-interactable element, such as a `<td>` tag, instead of the intended `<input>` field.
170+
3. **Hidden Elements**: The element is present in the DOM but not visible on the page due to CSS, the `hidden` attribute, or being outside the visible viewport.
171+
172+
### Possible Solutions
173+
174+
1. Use actions appropriate for the element type (e.g., use `sendKeys` with `<input>` fields only).
175+
2. Ensure locators uniquely identify the intended element to avoid incorrect matches.
176+
3. Check if the element is visible on the page before interacting with it. Use scrolling to bring the element into view, if required.
177+
4. Use explicit waits to ensure the element is interactable before performing actions.

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

+17
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,20 @@ Actions class with `Actions.moveToElement(element)`.
161161
- 确保 WebDriver 版本与浏览器版本匹配。对于 Chrome,请在浏览器中访问 `chrome://settings/help` 检查浏览器版本,并从 [ChromeDriver 下载](https://chromedriver.chromium.org/downloads)页面下载匹配的驱动程序。
162162
- 在 macOS 上,转到 **系统设置 > 隐私与安全性**,并允许驱动程序运行(如果被阻止)。
163163
- 验证驱动程序二进制文件是否可执行(在 Linux/macOS 上运行 `chmod +x /path/to/driver`)。
164+
165+
## ElementNotInteractableException
166+
167+
当 Selenium 尝试与当前状态下无法交互的元素进行交互时,会发生此异常。
168+
169+
### 可能的原因
170+
171+
1. **不支持的操作**:尝试对不支持操作的元素执行操作,例如对 `<form>``<label>` 使用 `sendKeys`
172+
2. **多个元素匹配定位器**:定位器匹配到非可交互的元素,例如 `<td>` 标签,而不是目标的 `<input>` 字段。
173+
3. **隐藏的元素**:元素存在于 DOM 中,但由于 CSS、`hidden` 属性或元素超出可见视口范围而不可见。
174+
175+
### 可能的解决方案
176+
177+
1. 根据元素类型使用适当的操作(例如,仅对 `<input>` 字段使用 `sendKeys`)。
178+
2. 确保定位器唯一标识目标元素,以避免错误匹配。
179+
3. 在与元素交互之前,检查其是否在页面上可见。如果需要,将元素滚动到视图中。
180+
4. 使用显式等待以确保元素在执行操作前可交互。

0 commit comments

Comments
 (0)