Tuesday, December 30, 2014

Python / Django / Selenium: "Webdriver Exception: Unable to start phantomjs with ghostdriver"

You might be using an outdated version of Selenium or possibly running it on Windows. Try the latest version of Selenium for Python first.

However, if that doesn't solve your issues you might have a failing test and not closing the webdriver down in your teardown method in your test if you have a custom test case:
def setUp(self):
self.wd = webdriver.PhantomJS()
super(CustomLiveServerTestCase, self).setUp()

def tearDown(self):
super(CustomLiveServerTestCase, self).tearDown()


  1. Even after updating it presents the same problem.. I think it has to do with how PhantomJS is installed in the environment.. Is it from the the official repository or manually..

    I have installed it manually on my local environment and it works fine.. But when I push it to my production server I get this error.

  2. I tend to suspect that one of the reason this might errupt might be due to how PhantomJS has been installed. When this error is thrown , the phantomJS executable cannot be launched..

    While installing you may install PhantomJS in various ways. Either from using the repositories by ubuntu, mac or you could install it manually.

    Now for my case on my Development environment , whilst installing it manually it works but when i push it to my production enviroment , I get this error.