首页 新闻 会员 周边 捐助

selenium-webdriver python 运行一断脚本后,报错

0
悬赏园豆:10 [待解决问题]

我运行的脚本是:

from selenium import webdriver
browser = webdriver.Firefox()
browser.get("http://www.baidu.com")
browser.find_element_by_id("kw").send_keys("selenium")
browser.find_element_by_id("su").click()
browser.quit()

 

下面是报错信息,求解决啊!

Traceback (most recent call last):
  File "C:\test\test.py", line 2, in <module>
    browser = webdriver.Firefox()
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 61, in __init__
    keep_alive=True)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 71, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 113, in start_session
    'desiredCapabilities': desired_capabilities,
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 162, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 349, in execute
    return self._request(url, method=command_info[0], data=data)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 377, in _request
    resp = self._conn.getresponse()
  File "C:\Python27\lib\httplib.py", line 1045, in getresponse
    response.begin()
  File "C:\Python27\lib\httplib.py", line 409, in begin
    version, status, reason = self._read_status()
  File "C:\Python27\lib\httplib.py", line 365, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "C:\Python27\lib\socket.py", line 476, in readline
    data = self._sock.recv(self._rbufsize)
error: [Errno 10054]

谢谢大神了!

leexiang_home的主页 leexiang_home | 初学一级 | 园豆:197
提问于:2014-02-12 14:06
< >
分享
所有回答(4)
0

检查下环境配置是否OK?

tyne0921 | 园豆:174 (初学一级) | 2014-02-13 14:02
0

path 有问题,要重装系统,已经解决

may_蚂蚁 | 园豆:202 (菜鸟二级) | 2014-02-26 09:54
0

是不是没有安装firefox的selenium插件,搜索selenium IDE,安装

马僧 | 园豆:205 (菜鸟二级) | 2014-04-11 13:28
0

  请问您是怎么解决的呢?我也是这个报错。。。

cheCY | 园豆:202 (菜鸟二级) | 2018-04-27 11:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册