繁体   English   中英

单击输入,selenium 和 python

[英]click an input, selenium with python

我是 selenium 的新手,我正在尝试 selenium 单击按钮并发送密钥。 我已经尝试过使用 id、class 名称、xpath 并且我无法做到。 这是代码。

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)

这是我得到的错误:

Message: invalid element state: Element is not currently interactable and may not be manipulated
  (Session info: chrome=105.0.5195.127)

我遇到了同样的问题,我找到了如何让 Selenium 点击按钮:

driver.find_element_by_id('XXX').click()

尝试这个

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM