Reputation: 2415
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
Upvotes: 5
Views: 10272
Reputation: 1564
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/.
Upvotes: 0
Reputation: 2215
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.
Upvotes: 7
Reputation: 828
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?
Upvotes: 2
Reputation: 13
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.
Upvotes: 1