无法使用Python单击Enter String



我对此代码有问题:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
#Getting local session of Chrome
driver=webdriver.Chrome()
#put here the adress of your page
driver.get("https://www.google.co.in")
#put here the content you have put in Notepad, ie the XPath

elem=driver.find_elements_by_name('q')############### this is one of name 
elem.send_keys("google search through python")

driver.close()

输出显示Elem列表为空我为什么要获得无效列表?

Traceback (most recent call last):
  File "google.py", line 14, in <module>
    elem.send_keys("google search through python")
AttributeError: 'list' object has no attribute 'send_keys'  

谁能帮助我跟踪问题?

使用此方法查看是否发生了错误

elem=driver.find_elements_by_name('q')
for e in elem:
    e.send_keys("google search through python")

最新更新