TA的每日心情 | 擦汗 2019-7-31 09:14 |
---|
签到天数: 80 天 连续签到: 2 天 [LV.6]测试旅长
|
把geckodriver安装成功。初写了个脚本如下:# coding:utf-8
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import time #调入time函数
binary = FirefoxBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe")
driver =webdriver.Firefox(firefox_binary=binary)
driver.get("http://www.baidu.com")
driver.find_element_by_id("kw").send_keys("Selenium2")
driver.find_element_by_id("su").click()
time.sleep(3)
print(driver.title)
driver.quit()
但是执行之后,百度虽然打开了,又报了一个错误如下:
== RESTART: C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\baidu.py ==
Traceback (most recent call last):
File "C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\baidu.py", line 12, in <module>
driver.find_element_by_id("kw").send_keys("selenium3")
File "C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webelement.py", line 349, in send_keys
'value': keys_to_typing(value)})
File "C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webelement.py", line 493, in _execute
return self._parent.execute(command, params)
File "C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 249, in execute
self.error_handler.check_response(response)
File "C:\Users\IRH-PC\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Expected [object Undefined] undefined to be a string
请大神指点一下! |
|