Firefox更新后无法使用Selenium打开浏览器
我在Ubuntu Desktop 16.04上使用Selenium
WebDriver,但无法打开浏览器。Firefox更新后出现以下错误(在此之前,所有方法都可以正常工作):
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.
回答:
:目前的解决方案是降级Firefox!运行此命令以获取可用Firefox版本的列表。
apt-cache show firefox | grep Version
我的结果:
Version: 47.0+build3-0ubuntu0.16.04.1Version: 45.0.2+build1-0ubuntu1
安装:
sudo apt-get install firefox=45.0.2+build1-0ubuntu1
要保留此版本并禁止更新:
sudo apt-mark hold firefox
如果要取消保留Firefox版本并允许更新:
sudo apt-mark unhold firefoxsudo apt-get upgrade
以上是 Firefox更新后无法使用Selenium打开浏览器 的全部内容, 来源链接: utcz.com/qa/412051.html