Sohail
Sohail

Reputation: 597

Selenium Firefox driver raise exception OSError: [Errno 8] Exec format error

def setUp(self):
   display = Xvfb()
   display.start()
   fp = webdriver.FirefoxProfile()
   fp.set_preference("browser.download.folderList",2)
   fp.set_preference("browser.download.manager.showWhenStarting",False)
   fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/csv")
       self.browser= webdriver.Firefox(firefox_profile=fp)

On webdriver.firefox it raises an exception even I tried with geckodriver path

self.browser=webdriver.Firefox(executable_path='/usr/bin/geckodriver',firefox_profile=fp)

But still it raises an exception

 Traceback (most recent call last):
  File "fbCampaign.py", line 23, in setUp
    self.browser= webdriver.Firefox(executable_path='/usr/bin/geckodriver',firefox_profile=fp)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 157, in __init__
    self.service.start()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error

Upvotes: 3

Views: 1871

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193088

This error message...

OSError: [Errno 8] Exec format error

...means the geckodriver binary which you are trying to use was compiled for a different platform.

Solution

Download the GeckoDriver binary specific to your platform (Windows, Mac, Linux) from GeckoDriver Release Repository.

You must choose the correct GeckoDriver binary to match the underlying OS it will be run on:

  • geckodriver-v0.22.0-linux32.tar.gz: For Linux OS.
  • geckodriver-v0.22.0-macos.tar.gz: For MAC OSX.
  • geckodriver-v0.22.0-win32.zip: For Windows 32-bit OS.
  • geckodriver-v0.22.0-win64.zip: For Windows 64-bit OS.

Note: Once you download you need to unzip / untar the GeckoDriver binary.

Upvotes: 1

Related Questions