pythonseleniumfirefox-marionette

Connection refused with marionette driver (python)


I'm trying to run a web scraping script from cron. Using the selenium firefox it runs 6 times then crashes. I've raised a query on this but no one has even made a comment in a day so following some reading I thought I would try marionette.

I've followed the basic tutorial but I'm getting the following Traceback:

Traceback (most recent call last):
  File "clint-selenium-firefox.py", line 52, in <module>
    driver.start_session()
  File "/usr/local/lib/python2.7/dist-packages/marionette_driver/decorators.py", line 42, in _
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/marionette_driver/marionette.py", line 1230, in start_session
    self.protocol, _ = self.client.connect()
  File "/usr/local/lib/python2.7/dist-packages/marionette_driver/transport.py", line 213, in connect
    self.sock.connect((self.addr, self.port))
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused

This is happening here:

driver = Marionette('localhost', port=2828)
driver.start_session()

I am running this on a Ubuntu 16 server without a display from the command prompt at this stage. My firefox version of the script is using pyvirtualdisplay to emulate the display and I left that in. I don't know if this is the issue?

Any help most welcome.


Solution

  • I solved it using this link which was my original question (I tried this route because I was struggling).