I am trying to populate form fields via selenium in python:
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Firefox()
driver.get("http://www.miralinks.ru/")
driver.implicitly_wait(30)
login = driver.find_element_by_css_selector('input[placeholder="Логин"]')
hov = ActionChains(driver).move_to_element(login)
hov.perform()
login.clear()
login.send_keys("login")
pwd = driver.find_element_by_css_selector('input[placeholder="Пароль"]')
pwd.clear()
pwd.send_keys("pass")
but this fails with exception:
Element is not currently interactable and may not be manipulated
Why this happens and gow to fix this?
webdriver __version__ = '2.45.0'
.
Use a wait function before the element that gave the error.
The webdriver is trying to interact with an element not completely loaded.
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="Пароль"')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With