简体   繁体   中英

click an input, selenium with python

I´m new to selenium and i´m trying that selenium click a button and send keys. I've tried with id, class name, xpath and i haven't been able to do it. 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:

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

Try this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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