Firefox更新后无法使用Selenium打开浏览器我在UbuntuDesktop 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.
3 回答
12345678_0001
TA贡献1802条经验 获得超5个赞
brew install geckodriver
wires.exe
wires
使用本地Web驱动程序时:
firefox_capabilities = DesiredCapabilities.FIREFOX firefox_capabilities['marionette'] = Truedriver = webdriver.Firefox(capabilities=firefox_capabilities)
driver = Selenium::WebDriver.for :firefox, marionette: true
var capabilities = Capabilities.firefox();capabilities.set('marionette', true); var driver = new webdriver.Builder().withCapabilities(capabilities).build();
DesiredCapabilities capabilities = DesiredCapabilities.firefox();capabilities.setCapability("marionette", true); Webdriver driver = new FirefoxDriver(capabilities);
var driver = new FirefoxDriver(new FirefoxOptions());
使用Selenium网格时:
当使用Selenium网格时,驱动程序应该出现在网格中所有机器的路径中。
firefox_capabilities = DesiredCapabilities.FIREFOX firefox_capabilities['marionette'] = Truedriver = webdriver.Firefox(capabilities=firefox_capabilities)
caps = Selenium::WebDriver::Remote::Capabilities.firefox marionette: true driver = Selenium::WebDriver.for :firefox, desired_capabilities: caps
DesiredCapabilities capabilities = DesiredCapabilities.firefox(); // Set Marionette on so the Grid will use this instead of normal FirefoxDrivercapabilities.setCapability("marionette", true); WebDriver driver = new RemoteWebDriver(capabilities);
DesiredCapabilities capabilities = DesiredCapabilities.Firefox(); // Set Marionette on so the Grid will use this instead of normal FirefoxDrivercapabilities.SetCapability("marionette", true); var driver = new RemoteWebDriver(capabilities);
慕妹3242003
TA贡献1824条经验 获得超6个赞
固定
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
sudo apt-mark hold firefox
如果您想要取消Firefox版本并允许更新:
sudo apt-mark unhold firefox sudo apt-get upgrade
添加回答
举报
0/150
提交
取消