In the process of automatic testing, the code has no errors, and the following errors can be encountered many times during running:
selenium. Common. Exceptions. Elementnotinteractableexception: Message: element not interactable
At present, I think of the following three solutions:
method 1:
using time. Sleep() can reduce the probability of this exception, but it is not 100% effective and wastes time.
Method 2:
use driver. Refresh() to refresh the page and then reposition this element.
Method 3:
in many cases during the test process, there will be deviations in the test results after refreshing the page. In this case, we can only use the method of capturing exceptions to avoid the current exceptions. That is, reposition the element when an exception occurs.
1 # time.sleep(2) 2 # driver.refresh() 3 try: 4 driver.find_element_by_id("details-button").click() 5 driver.find_element_by_id("proceed-link").click() 6 except: 7 driver.find_element_by_id("details-button").click() 8 driver.find_element_by_id("proceed-link").click()
Similar Posts:
- Four ways to solve selenium’s error “element is not clickable at point…”
- [Solved] Selenium Error: ElementClickInterceptedException
- Message: stale element reference: element is not attached to the page document error solution
- Pytest @pytest.mark.parametrize Example
- selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
- Selenium Error: ElementNotInteractableException: Message: element not interactable
- Common error reports and solutions of ionic 3
- How to Solve stale element reference: element is not attached to the page document
- [Solved] nvidia-smi Error: Failed to initialize NVML: Driver/library version mismatch
- How to fix Windows 10 camera crash and BSOD spuvcbv64.sys error