Trying to execute simple test
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get(\'http://g
WebDriver instance does not have send_keys()
method. That's what the error is actually about:
'WebDriver' object has no attribute 'send_keys'
Call send_keys()
on a WebElement instance which is returned by find_element_by_*()
methods - find_element_by_name()
in your case:
element = driver.find_element_by_name('q')
element.send_keys("hey")
And just FYI, there is also an ActionChains class which is useful do build up chains of actions or apply more complex actions like drag&drop or mouse move. It's an overhead in this case, but just for the sake of an example:
from selenium.webdriver.common.action_chains import ActionChains
actions = ActionChains(driver)
actions.move_to_element(element).send_keys("hey").perform()