Forums

Selenium from within a django app

I am trying to create a web-scrapping tool with a Djnago app as a GUI.

I have been able to get selenium up and running on my PythonAnywhere account by following the instructions on this thread . ie. When I open a python console from command line, and run my scripts it works fine.

However when I try to run the exact same code from within a Django app running on PythonAnywhere I get the following error:

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.

UPDATE: I tried running the same code from my local Djnago app and it worked fine. In both cases it's selenium 2.53.6 and Django 1.10.2

Hi there,

I see that there are a bunch of left over xvfb processes that are hanging around. Most likely you opened too many and never closed them and so any new attempts to create virtual displays are now failing.

I have manually killed these for you.

If you make sure your code always closes the virtual displays you should be good.

Are you using Django for more than the web scraping? I am thinking that simple web scraping can be done with a lot less overhead.