I am trying to populate form fields via selenium in python:
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
Here xpath selectors working.
login = driver.find_element_by_xpath('//*[@id=\'loginForm\']/div/div[1]/input')
pwd = driver.find_element_by_xpath('//*[@id=\'loginForm\']/div/div[2]/input')
or same but css selector
login = driver.find_element_by_css_selector('form#loginForm [name="data[User][login]"]')
pwd = driver.find_element_by_css_selector('form#loginForm [name="data[User][password]"]')
Sometimes it takes time to load the page. You can add wait statement. Try using "Thread.sleep(3000)"
For me, the problem was because another element was overlaying the input box. In my case, there was a fancy label in place of a placeholder that animates upwards on click.
The trick was to click on the label first to trigger the animation and then fill in the input field
I had this problem as well, but in my case the cause was slightly different. I needed to specify the size of the window before navigating to the page:
driver.Manage().Window.Size = new Size(width, height);
This is because the default window size was rendering the page at a width where a media query had hidden the element, which caused the "Element is not currently interactable and may not be manipulated" error.
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="Пароль"')
Use a wait function before the element that gave the error.
The webdriver is trying to interact with an element not completely loaded.