5

I got this exception when I want to use FireFox webdriver

raise WebDriverException "The browser appears to have exited " 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.

I read this question and updated my selenium, but I already have the same problem.

my code :

driver = webdriver.Firefox()
time.sleep(5)
driver.get('http://www.example.com')

UPDATE

I read this question

and now I have this error

OSError: [Errno 20] Not a directory
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x407a690>> ignored
parik
  • 2,313
  • 12
  • 39
  • 67

5 Answers5

7

If you're running Selenium on Firefox 47.0, you need to update to Firefox 47.0.1 which is not released in Ubuntu's main repos.. so you have to add this PPA: https://launchpad.net/~ubuntu-mozilla-security/+archive/ubuntu/ppa

Release notes: https://www.mozilla.org/en-US/firefox/47.0.1/releasenotes/

"Selenium WebDriver may cause Firefox to crash at startup"

Once Firefox 48.0 is out, it will include the fix. I think Ubuntu has skipped this update because it affects very few users.

I can confirm the error with FF 47.0 and Selenium 2.53, and I can also confirm that upgrading to FF 47.0.1 fixes the error.

benjaoming
  • 2,135
  • 1
  • 21
  • 29
  • 1
    for my new server setting, I have Firefox 47.0.1 and selenium 2.53.06, but I still got this error. And for my local development with Firefox 47.0.1 and selenium 2.53.05 works. I am now stucked at how to downgrade selenium to 2.53.05, do you have any idea about this? – zhihong Aug 18 '16 at 13:41
  • The FF version was indeed the problem in my case. Looks like Ubuntu is now up to FF 48, which works OK. – mc0e Sep 18 '16 at 16:40
3

This is fixed by updating firefox 47.0.0 to 47.0.1 manually

Mesut GUNES
  • 7,089
  • 2
  • 32
  • 49
  • 2
    it works with Selenium webdriver Version: 2.53.6 (tested). firefox 47.0.0 is the culprit. 47.0.1 works! thanks @gunesmes – Dung Oct 12 '16 at 05:23
2

Just for people like me wasting hours with installing several firefox versions to make this working: same message error appears if you are running tests in an environment without display (e.g. SSH to your vagrant box).

sudo apt-get install xvfb

#set display number to :99
Xvfb :99 -ac &
export DISPLAY=:99

Remember to put this in a .bashrc because it's valid only in the current session shell.

From:

Is it possible to run selenium (Firefox) web driver without a GUI?

BangTheBank
  • 809
  • 3
  • 11
  • 26
  • 1
    This is not answer of this question – parik Jul 22 '17 at 16:22
  • @parik This is actually an answer to the question as the error message is the same: WebDriverException "The browser appears to have exited " etc. and I've solved with this. – BangTheBank Jul 22 '17 at 20:09
  • @BangTheBank BangTheBank In the case of this question we USE the GUI and your answer have no sense – parik Jul 24 '17 at 09:21
1

I was having the same problem with my selenium script. I had to make sure that I was using the proper software versions as described in the selenium installation documentation, namely Pyhton 3.5 and Firefox version 45 (https://support.mozilla.org/en-US/kb/install-older-version-of-firefox). I am using the selenium version 2.9.1 although from reading around 2.53 may work best.

I noticed in the comments you also questioned how you can check the version of your Firefox. To do this you can go open a Firefox browser, click the menu button and click the question mark at the bottom of the pop-out menu, and finally click "About Firefox". The version number should be the second line of text in the pop-up. There may be other ways to do so but this worked for me.

Hopefully this will help you get your script to run.

  • 1
    as you said, i installed older version of FF, i checked it by firefox -v and i have FF 43, but it doesn't solve my problem – parik Jun 29 '16 at 16:07
  • 1
    Hmm... not quite sure then. I had the error as you did before your edit and after I downloaded the correct versions of the software and reinstalled selenium 2.5 on my FF 45, I ran your script in python 3.5 and it worked as expected. I would say check your versions again but aside from that I am not sure pal. Sorry for your troubles. – JoeDocei Hill Jun 30 '16 at 18:24
0

1.Install latest Firefox (mine is 50.1.0)

apt-get install firefox

2- Download latest geckodriver from this repo

3- unzip the downloaded file

tar -xvf geckodriver-v0.13.0-linux64.tar.gz

4- mv ./geckodriver /usr/bin

5- ln -s /usr/bin/geckodriver /usr/local/bin/.

SiHa
  • 7,830
  • 13
  • 34
  • 43
IslamTaha
  • 1,056
  • 1
  • 10
  • 17