Python Selenium - Element Is Not Currently Interactable and May Not Be Manipulated

python selenium - Element is not currently interactable and may not be manipulated

The problem is that there are two other input elements with placeholder="Логин" and placeholder="Пароль" which are invisible. Make your CSS selectors specific to the login form:

login = driver.find_element_by_css_selector('form#loginForm input[placeholder="Логин"]')
pwd = driver.find_element_by_css_selector('form#loginForm input[placeholder="Пароль"')

How to resolve 'Element is not currently interactable and may not be manipulated' and why my test case still can go through

It tough to debug an exception/error without the relevant Code Trial and relevant HTML. However there seems to be an issue as follows :

The main issue here is the version compatibility between the binaries you are using as follows :

  • You are using chromedriver=2.35
  • Release Notes of chromedriver=2.35 clearly mentions the following :

Supports Chrome v62-64

  • You are using chrome=65.0
  • Release Notes of ChromeDriver v2.37 clearly mentions the following :

Supports Chrome v64-66

So there is a clear mismatch between ChromeDriver version (v2.35) and the Chrome Browser version (v65.0)

Solution

  • Upgrade ChromeDriver to current ChromeDriver v2.37 level.
  • Keep Chrome version at Chrome v65.x levels. (as per ChromeDriver v2.37 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
  • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test.
How you escaped

Though you faced org.openqa.selenium.InvalidElementStateException and your test would have beenaborted KATALON STUDIO managed to keep the session alive and you were through.

InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated

The webElement your are trying to interact with is either not clickable or it is disabled or may be it is out of browser's viewport. Selenium API is successful only on active interact-able webelements. Use Javascript, as a last mile solution.

element not interactable: Element is not currently visible and may not be manipulated

To select an item from the Housing type dropdown on the page you provided, I would first invoke WebDriverWait on the dropdown menu to ensure that it exists before you try to interact with it. Then, you can use Javascript to click the dropdown trigger and expand the options.

After that, we invoke WebDriverWait once more on the option we wish to click. The following code sample will click the option 'flat':

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


# start driver
driver = webdriver.Chrome(executable_path=r'D:/apps/chromedriver/chromedriver.exe')
driver.get('https://post.craigslist.org/k/tKNKfCkr6hG7ghq71YXqTA/oj7w8?s=edit')

# wait for dropdown to exist
WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH, "//label[contains(@class, 'housing_type')]")))

# expand housing type dropdown using javascript
dropdown_trigger = driver.find_element_by_xpath("//label[contains(@class, 'housing_type')]/span/span[contains(@class, 'ui-icon')]")
driver.execute_script("arguments[0].click();", dropdown_trigger)

# select an option -- this selects 'flat'
dropdown_option = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH, "//li[text()='flat']")))
dropdown_option.click()

Element is not currently visible and may not be manipulated - Selenium webdriver

My guess is that SELECT is not actually visible (hence the error) but instead some other elements form a dropdown and that hidden SELECT holds the value.

Python Selenium, Dropdown Option Element is not currently visible and may not be manipulated

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')



Related Topics



Leave a reply



Submit