4

I am using firefox gecko driver to make a bot, I keep getting error messages with my bot and I have found that the source of the message is the:

from selenium import webdriver

browser= webdriver.Firefox()

lines.

I have added every file mentioned in the error message to path including gecko driver, firefox, and the other smaller documents. I am at a complete loss

Here is the error message:

Traceback (most recent call last):
  File "/usr/local/bin/fuckobot1.py", line 3, in <module>
    browser= webdriver.Firefox()

File "/Users/'myname'/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
    self.service.start()

File "/Users/'myname'/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child

raise child_exception
OSError: [Errno 8] Exec format error
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
PYANNANANA
  • 63
  • 1
  • 5

2 Answers2

4

This error message...

OSError: [Errno 8] Exec format error

...implies that the GeckoDriver binary which was invoked was not in proper format.

Your main issue is the incompatibility of the GeckoDriver binary format with respect to the underlying Operating System.

As you are on MacOS you need to download geckodriver-v0.23.0-macos.tar.gz from mozilla/geckodriver, untar/unzip it and provide the absolute path of the GeckoDriver through the argument executable_path as follows:

from selenium import webdriver

browser= webdriver.Firefox(executable_path='/path/to/geckodriver')
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

This may be answer to this issue,
when it shows something like, Your Firefox profile cannot be loaded. It may be missing or inaccessible.
Actual problem is, Firefox 48.0 or greater not works with selenium 3.0.0 or greater version.
so please check your versions. so, to make it work you need to update with recent selenium and respective geckodriver version too that fixes this issue.

then try basic commands,

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox() 
Ashish Kamble
  • 2,555
  • 3
  • 21
  • 29