'Python Selenium, Dropdown Option Element is not currently visible and may not be manipulated
I'm getting this error
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable: Element is not currently visible and may not be manipulated
For this line with //option[. = 'Individual']
dropdown = self.driver.find_element(By.CSS_SELECTOR, "#selectClaimantTypeContainer select")
WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located((By.XPATH, "//option[. = 'Individual']"))).click()
I've added WebDriverWait and still the error persists? The dropdown options are loaded dynamically via ajax.
How do i solve? This is how the code looks with WebDriverWait
dropdown = self.driver.find_element(By.CSS_SELECTOR, "#selectClaimantTypeContainer select")
dropdown.find_element(By.XPATH, "//option[. = 'Individual']").click()
Solution 1:[1]
Looks like it's a Select element there. So you need to select the desired option by value or by visible text, as following:
dropdown = self.driver.find_element(By.CSS_SELECTOR, "#selectClaimantTypeContainer select")
dropdown.select_by_visible_text('Individual')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Prophet |
