Firefox 更新后无法使用 Selenium 打开浏览器 [英] Can't open browser with Selenium after Firefox update

查看:35
本文介绍了Firefox 更新后无法使用 Selenium 打开浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Ubuntu Desktop 16.04 上使用 Selenium WebDriver,但无法打开浏览器.Firefox 更新后出现以下错误(在此之前,一切正常):

I use Selenium WebDriver on Ubuntu Desktop 16.04, and I can't open browser. I get the following error after Firefox update (before this, it all worked):

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    driver = webdriver.Firefox()
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 81, in __init__
    self.binary, timeout)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "/usr/local/lib/python3.5/dist-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.

推荐答案

FIXED:这时候的解决办法是降级火狐!运行此命令以获取可用 Firefox 版本的列表.

FIXED: Solution at this time is to downgrade Firefox! run this command to get a list of available Firefox versions.

apt-cache show firefox | grep Version

我的结果:

Version: 47.0+build3-0ubuntu0.16.04.1
Version: 45.0.2+build1-0ubuntu1

安装:

sudo apt-get install firefox=45.0.2+build1-0ubuntu1

要保留此版本并禁止更新:

To keep this version and disallow updates:

sudo apt-mark hold firefox

如果您想取消保留 Firefox 版本并允许更新:

sudo apt-mark unhold firefox
sudo apt-get upgrade

这篇关于Firefox 更新后无法使用 Selenium 打开浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆