1

I wrote an automation program to open up youtube and to type in chillhop then allow the automation to click search. When i run the script it only opens my browser and opens youtube then i get a error the program stops Here is the error:

Traceback (most recent call last):
  File "automation.py", line 13, in <module>
    searchbox.send_keys('chillhop')
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 479, in send_keys
    'value': keys_to_typing(value)})
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: Element <g id="search"> is not reachable by keyboard

and this is the code that i put in :

from selenium import webdriver

#varible of drive to run open up the firefox browser
driver = webdriver.Firefox()

#open this website
driver.get('https://youtube.com')

#create a varible to store the xpath of the search bar on youtube
searchbox = driver.find_element_by_xpath('//*[@id="search"]')

#to type in the search box
searchbox.send_keys('chillhop')

#click the search button
searchbutton = driver.find_element_by_xpath('//*[@id="search-icon-legacy"]')
searchbutton.click()
  • Here's a related reference https://stackoverflow.com/questions/49864965/org-openqa-selenium-elementnotinteractableexception-element-is-not-reachable-by – katardin Mar 25 '20 at 16:36
  • 1
    Does this answer your question? [org.openqa.selenium.ElementNotInteractableException: Element is not reachable by keyboard: while sending text to FirstName field in Facebook](https://stackoverflow.com/questions/49864965/org-openqa-selenium-elementnotinteractableexception-element-is-not-reachable-by) – katardin Mar 25 '20 at 16:36

0 Answers0