I'm new to Selenium(Python). I'm trying to get the program to open google.com and type in a piece of text to be searched. Everything is fine, except it doesn't click Enter to search.
Here's the source code
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome('C:\Anaconda3\Lib\idlelib\chromedriver.exe')
driver.set_page_load_timeout("10")
driver.get("http://google.com")
driver.find_element_by_name("q").send_keys(//The piece of text)
driver.find_element_by_name("btnK").send_key(Keys.RETURN)
time.sleep(4)
And it is throwing me this error
AttributeError: 'WebElement' object has no attribute 'send_key'
Can anyone tell me where I'm wrong and what I should do to fix it?