Can't open browser with Selenium after Firefox update -
i use selenium webdriver on ubuntu desktop 16.04, , can't open browser. following error after firefox update (before this, 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 have exited " selenium.common.exceptions.webdriverexception: message: browser appears have exited before connect. if specified log_file in firefoxbinary constructor, check details.
as of firefox version 47.0 (which came out little while go), new driver must used (created mozilla instead of selenium) connect firefox, because of bug introduces in version. of firefox version 48.0 old driver deprecated , marionette can used better switch now. see: marionette webdriver firefox
download driver (in osx use brew install geckodriver
), rename executable wires.exe
on windows, or wires
on *nix systems, , make sure executable present in system path, use driver in program instead of old driver using following:
when using local webdriver:
python:
firefox_capabilities = desiredcapabilities.firefox firefox_capabilities['marionette'] = true driver = webdriver.firefox(capabilities=firefox_capabilities)
ruby:
driver = selenium::webdriver.for :firefox, marionette: true
javascript:
var capabilities = capabilities.firefox(); capabilities.set('marionette', true); var driver = new webdriver.builder().withcapabilities(capabilities).build();
java:
desiredcapabilities capabilities = desiredcapabilities.firefox(); capabilities.setcapability("marionette", true); webdriver driver = new firefoxdriver(capabilities);
c#:
var driver = new firefoxdriver(new firefoxoptions());
when using selenium grid:
when using selenium grid driver should present in path machines in grid.
python:
firefox_capabilities = desiredcapabilities.firefox firefox_capabilities['marionette'] = true driver = webdriver.firefox(capabilities=firefox_capabilities)
ruby:
caps = selenium::webdriver::remote::capabilities.firefox marionette: true driver = selenium::webdriver.for :firefox, desired_capabilities: caps
java:
desiredcapabilities capabilities = desiredcapabilities.firefox(); // set marionette on grid use instead of normal firefoxdriver capabilities.setcapability("marionette", true); webdriver driver = new remotewebdriver(capabilities);
c#:
desiredcapabilities capabilities = desiredcapabilities.firefox(); // set marionette on grid use instead of normal firefoxdriver capabilities.setcapability("marionette", true); var driver = new remotewebdriver(capabilities);
Comments
Post a Comment