[英]click an input, selenium with python
I´m new to selenium and i´m trying that selenium click a button and send keys.我是 selenium 的新手,我正在尝试 selenium 单击按钮并发送密钥。 I've tried with id, class name, xpath and i haven't been able to do it.我已经尝试过使用 id、class 名称、xpath 并且我无法做到。 Here is the code.这是代码。
website = "https://weather.com/?Goto=Redirected"
path = "C:/Users/Administrador/Downloads/chromedriver_win32/chromedriver.exe"
driver = webdriver.Chrome(service=Service(path))
driver.get(website)
button = driver.find_element(By.XPATH, '//*[@id="LocationSearch_input"]')
button.clear()
button.send_keys("medellin")
button.send_keys(Keys.RETURN)
time.sleep(3)
and this is the error that i get:这是我得到的错误:
Message: invalid element state: Element is not currently interactable and may not be manipulated
(Session info: chrome=105.0.5195.127)
I had the same problem and i found how to ask Selenium to click a button:我遇到了同样的问题,我找到了如何让 Selenium 点击按钮:
driver.find_element_by_id('XXX').click()
Try this尝试这个
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.