-1

I am getting this error for my python script. I am trying to use selenium firefox headlessly. any solution please ?

Traceback (most recent call last):
  File "myextractor.py", line 297, in <module>
    testweb_myextractor.Run()
  File "myextractor.py", line 80, in Run
    self.driver.get(self.link_to_explore)
  File "/home/dev/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 213, in get
    self.execute(Command.GET, {'url': url})
  File "/home/dev/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 199, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/home/dev/.local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 395, in execute
    return self._request(command_info[0], url, body=data)
  File "/home/dev/.local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 425, in _request
    self._conn.request(method, parsed_url.path, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1048, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1088, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1044, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 888, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 850, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 831, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 575, in create_connection
    raise err
socket.error: [Errno 111] Connection refused
rhb
  • 1

2 Answers2

0

Look like your webdraver isnt compatibile with browser.

Download latest Selenium WebDriver version and Firefox ESR. Its stable version of mozilla without updates.

https://www.mozilla.org/en-US/firefox/organizations/faq/

Its help you now and in the future ;)

Saganowsky
  • 103
  • 1
  • 10
0

Requirements:

  1. Install Firefox Nightly
  2. Download latest geckodriver.exe & place it in PATH

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

from selenium import webdriver

//point to the location of firefox nightly binary = FirefoxBinary('C:\\Program Files\\Nightly\\firefox.exe', log_file=sys.stdout)

driver = webdriver.Firefox(firefox_binary=binary)

More info at: https://intoli.com/blog/running-selenium-with-headless-firefox/

sri
  • 801
  • 9
  • 10