无法点击使用python

我有这个代码的问题输入字符串:无法点击使用python

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")

以上是 无法点击使用python 的全部内容, 来源链接: utcz.com/qa/259919.html

回到顶部