Python3 web automation error - ElementNotInteractableException: Message: element not interactable

Viewed 26

New to coding and programming here. Just wondering if anyone knows why the code below is returning an "ElementNotInteractableException" error? It seems to be coming from the "search" part because I run the code without it an I did not get an error. I am trying to automate a YouTube search for "cat videos". I'm able to open YouTube but not perform the typing on the search bar. Thanks a lot!

Below is the code:

from selenium import webdriver

driver = webdriver.Chrome()
driver.get('http://youtube.com')

search = driver.find_element_by_xpath('//*[@id="search"]')
*search.send_keys('cat videos')*

searchButton = driver.find_element_by_xpath('//*[@id="search-icon-legacy"]')
searchButton.click()
0 Answers
Related