Tag Archives: The crawler?

solve selenium.common.exceptions .ElementNotInteractableException: Message: element not interactable

Without further ado, go straight to the method:
The original part of the code is:

username=self.wait.until(EC.presence_of_element_located((By.ID,'loginName')))
password=self.wait.until(EC.presence_of_element_located((By.ID,'loginPassword')))
submit=self.wait.until(EC.presence_of_element_located((By.ID,'loginAction')))
username.send_keys(self.username)
password.send_keys(self.password)
submit.click()

After the operation error: selenium.com mon. Exceptions. ElementNotInteractableException: Message: element not interactable.
Solution: 1. Overwrite other elements temporarily to ensure your own element
We can change the waiting conditions By self.wait. Until (expected_conditions.invisiblity_of_element_located((by.id,’id_of_the_element_to_be_invisiblity’)))).
The other is self.wait. Until (expected_conditions.element_to_be_clickable((by.id,’id_of_the_element_to_be_clickable’))). Here I use the second method.

 submit=self.wait.until(EC.element_to_be_clickable((By.ID,'loginAction')))

2. Permanently overwrite elements to secure your own.
The method is the following code:

WebElement ele = driver.findElement(By.xpath("element_xpath"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", ele);

The second method has not been well understood for the time being, and those who have understood can communicate with each other.