[英]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.