Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

I have installed firefox and Xvfb on my centos6.4 server to use selenium webdriver.

But, when I run the code, I got an error.

from selenium import webdriver

browser = webdriver.Firefox()


selenium.common.exceptions.WebDriverException: Message: 

'The browser appears to have exited before we could connect. The output was: None'

I read some related pages on stackoverflow and someone suggested to remove all files in tmp folder, so I did it. But, it still doesn't work.

Could anyone please give me a help?

Thank you in advance!


 Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/", line 59, in __init__

    self.binary, timeout),

  File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/", line 47, in __init__


  File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/", line 64, in launch_browser


  File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/", line 103, in _wait_until_connectable


selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have exited     before we could connect. The output was: None' 


1 Answer

0 votes
by (62.9k points)

If its a Python code, then you are required to install Xvfb and then pyvirtualdisplay.

PS: It worked for me on my Ubuntu server.

sudo apt-get install xvfb

sudo pip install pyvirtualdisplay

//Once you have done that, the python code should work:

#!/usr/bin/env python

from pyvirtualdisplay import Display

from selenium import webdriver

display = Display(visible=0, size=(1024, 768))


browser = webdriver.Firefox()


print browser.page_source



Hope this helps!

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s Selenium training!

Browse Categories