0
我想要去Google,然后使用Selenium + Python键入“Hello world”。使用Selenium将搜索文本输入到Google中
from selenium import webdriver
import time
import json
driver = webdriver.PhantomJS(executable_path='/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs')
driver.get("http://www.google.com")
一切都到这部分工作正常。但是现在我无法理解如何选择文本字段并输入文本。搜索栏有一个ID #gbqfq
,但下面的代码返回一个错误。
driver.webElement('body', 'gbqfq')
错误:
'WebDriver' object has no attribute 'webelement'
下面是文档:
您的错误与您的示例不符。 – Veedrac 2014-10-07 08:09:11