By Alexa Iulian


2016-06-11 08:32:09 8 Comments

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.

7 comments

@Sachin Nikam 2016-11-15 11:56:31

No need to downgrade Firefox. I have faced issue with Windows and Firefox 49 version. I was using geckodrvier 64 bit version. I changed it to geckodrvier 32 bit version and it solved the issue. Now browser is opening properly without any issue.

@Mobrockers 2016-06-11 15:53:04

As of Firefox version 47.0 (which came out a little while a go), a new driver must be used (created by mozilla instead of selenium) to connect to Firefox, because of a bug introduces in this version. As of Firefox version 48.0 the old driver will be deprecated completely and only Marionette can be used so it is better to switch now. See: Marionette Webdriver for Firefox

Download the driver (in OSX just use brew install geckodriver), rename the executable to wires.exe on windows, or wires on *nix systems, and make sure the executable is present in your system path, then use this driver in your program instead of the old driver by using the following:

When using a 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 a selenium grid the driver should be present in the path for all machines in your 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 so the Grid will use this instead of normal FirefoxDriver
capabilities.setCapability("marionette", true);

WebDriver driver = new RemoteWebDriver(capabilities); 

C#:

DesiredCapabilities capabilities = DesiredCapabilities.Firefox();
// Set Marionette on so the Grid will use this instead of normal FirefoxDriver
capabilities.SetCapability("marionette", true);

var driver = new RemoteWebDriver(capabilities); 

@No Sssweat 2016-06-15 05:47:50

Once we download the driver, where are we suppose to put it?

@Mobrockers 2016-06-15 06:43:45

Put it wherever you want, then set the location to the driver in your system path.

@RemcoW 2016-06-16 14:06:32

According to the documentation of MarionetteDriver in the Java version of Selenium it is deprecated (github.com/SeleniumHQ/selenium/blob/master/java/client/src/‌​org/…). FirefoxDriver should be used instead and marionette should be enabled in the DesiredCapabilities (much like you did in the RemoteWebDriver example.

@Steve Saporta 2016-06-16 18:45:54

Marionette does solve the problem. It comes with some problems of its own, though. First, if you're using execute_script() to read the values of JavaScript variables, you'll need to prefix the variable name with window.wrappedJSObject. (bugzilla.mozilla.org/show_bug.cgi?id=825858). Second, some action chain functions aren't supported, such as move_to_element (groups.google.com/forum/#!topic/selenium-users/g8IK9AR7EIA)‌​.

@Ted Petrou 2016-06-19 05:28:44

Mobrockers, can you explain what mean by rename the executables to 'wires'. All I see is a file named geckodriver-0.8.0-OSX. But I still get the same error: "Message: 'wires' executable needs to be in PATH. " after I run the command export PATH=$PATH:/path/to/directory/of/executable/downloaded/in/pr‌​evious/step

@Mobrockers 2016-06-20 06:00:33

Rename geckodriver-0.8.0-osx to wires

@Stan 2016-07-26 12:27:47

For the lazy OSX users: brew install geckodriver

@bgusach 2016-08-23 11:30:57

FWIW I had to use geckodriver instead of wires

@8protons 2016-08-31 20:42:41

So the fix is to download a project that is still in beta?

@Mobrockers 2016-08-31 20:44:01

Mozillas decision.. Don't ask me why, I don't know.

@oxidworks 2016-11-01 14:05:42

where to import 'DesiredCapabilities' ? > from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

@Reuben 2016-09-27 23:05:31

1) Download geckodriver 0.6.2, unzip, rename to "wires" not "wires.exe" https://github.com/mozilla/geckodriver/releases

2) Add the wires executable location to PATH (I put this in my python folder C:Program Files\Python...) Select Start, select Control Panel. double click System, and select the Advanced tab. Click Environment Variables. ... In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. ... (Use ';' to separate paths i.e. [C:Users\Reuben;C:Program Files\Python]

3) Downgrade to Firefox 45 https://ftp.mozilla.org/pub/firefox/releases/45.0.2/win64/en-US/

@Mohit Tater 2016-07-02 21:14:40

Solution : Upgrade Firefox to 47.0.1 and Selenium to 2.53.1.

This combination worked for me.

For more details refer to https://stackoverflow.com/a/37728659/6469532

@user1412586 2016-06-22 10:02:34

SOLUTION downgrade to 45 version:

firefox --version
    Mozilla Firefox 47.0
apt-get remove firefox
wget https://ftp.mozilla.org/pub/firefox/releases/45.0/linux-x86_64/en-US/firefox-45.0.tar.bz2
tar -xjf firefox-45.0.tar.bz2
mv firefox /opt/firefox45
ln -s /opt/firefox45/firefox /usr/bin/firefox
firefox --version
    Mozilla Firefox 45.0

@Alex 2016-07-21 09:59:35

Also works if you manually upgrade to 47.0.1

@Alexa Iulian 2016-06-11 09:25:22

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

My Result:

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

Install:

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

To keep this version and disallow updates:

sudo apt-mark hold firefox

If you want to unhold firefox version and allow updates:

sudo apt-mark unhold firefox
sudo apt-get upgrade

@silviomoreto 2016-06-21 21:26:39

About the version 45, I am getting the error: E: Version '45.0.2+build1-0ubuntu1' for 'firefox' was not found any hints?

@Alexa Iulian 2016-06-23 20:14:12

Try to add Firefox repository before: sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa

@easy_c0mpany80 2016-11-07 10:53:53

I tried this, restarted Firefox after then when I ran grep Version again it was still telling me I was on the latest version (49) but then when I run the install part again it tells me 45 is already installed. Do I have a conflict now?

@trantu 2016-06-15 19:03:40

Some people have the problem that some buttons or select boxes cannot be selected inmarionette modus.

An alternative is using older firefox version:

You can download the binary here and use it here:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary('path/to/binary')
driver = webdriver.Firefox(firefox_binary=binary)

Related Questions

Sponsored Content

0 Answered Questions

Python Selenium getting started error

2 Answered Questions

[SOLVED] Python Selenium setting path to firefox profile (ubuntu)

1 Answered Questions

10 Answered Questions

1 Answered Questions

Selenium doesn't open the browser in Python

6 Answered Questions

[SOLVED] Python Selenium binding with TOR browser

1 Answered Questions

[SOLVED] selenium can't open firefox

1 Answered Questions

[SOLVED] Firefox blank webbrowser with selenium

0 Answered Questions

0 Answered Questions

Selenium - Browser exits w/o doing anything

  • 2016-02-29 20:55:31
  • Santiago Redondo
  • 205 View
  • 0 Score
  • 0 Answer
  • Tags:   python selenium

Sponsored Content