码迷,mamicode.com
首页 > Web开发 > 详细

运行.py提示selenium.common.exceptions.WebDriverException

时间:2018-01-20 16:26:16      阅读:779      评论:0      收藏:0      [点我收藏+]

标签:use   cto   mes   package   提示   百度   call   process   ace   

今天打开上次运行成功的.py文件,发现报错,报错信息如下:in/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/zhangyanyan/PycharmProjects/untitled1/baidu.py

Traceback (most recent call last):

  File "/Users/zhangyanyan/PycharmProjects/untitled1/baidu.py", line 3, in

    driver = webdriver.Firefox()

  File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 81, in __init__

    self.binary, timeout)

  File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__

    self.binary.launch_browser(self.profile, timeout=timeout)

  File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser

    self._wait_until_connectable(timeout=timeout)

  File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 98, in _wait_until_connectable

    raise WebDriverException("The browser appears to have exited "

selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.

Process finished with exit code 1

百度了一下,猜测应该是本机的fi?refox安装后未设置为非自动更新,导致firefox自动更新到最新版本,而selenium最新版并不支持firefox的最新版。

解决方法:

方法一:降firefox版本;

方法二:升selenium 的jar包;?

方法三:下载与该版本selenium匹配的其他浏览器的驱动;

方法四:修改selenium兼容firefox版本的配置文件:

http://bbs.51testing.com/thread-1075662-1-1.html

运行.py提示selenium.common.exceptions.WebDriverException

标签:use   cto   mes   package   提示   百度   call   process   ace   

原文地址:https://www.cnblogs.com/ming1220/p/8320753.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!