0

my script

from selenium import webdriver
o = webdriver.Firefox()

and i get this problem

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 142, in __init__
    self.service.start()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "/usr/lib/python3.5/subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1283, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error

i searched on it and i found this OSError: [Errno 8] Exec format error selenium

i get chromedriver and put it in '/usr/local/bin/' like supposed, it doesn't help
and also did the same thing with geckodriver Trouble setting up selenium with python3(linux)

nothing work same error

and i try this shot

#!usr/bin/python
#!/usr/bin/env bash
from selenium import webdriver 
web = webdriver.Firefox(executable_path="/usr/local/bin/chromedriver")

it give me that error :

Traceback (most recent call last):
  File "/root/Desktop/test.py", line 5, in <module>
    web = webdriver.Firefox(executable_path="/usr/local/bin/chromedriver")
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 142, in __init__
    self.service.start()
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 96, in start
    self.assert_process_still_running()
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
    % (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /usr/local/bin/chromedriver unexpectedly exited. Status code was: 1

Note : operation system is kali linux SMP Debian 4.9.18-1kali1 version, firefox and selenium is up to date

Fathy
  • 377
  • 5
  • 13
  • Can you run geckodriver / chromedriver from the command line? Could it be that you're trying to run a windows executable on Linux, or an ELF executable on some Linux that doesn't support it, or something like that? – Paul Hicks Jul 20 '17 at 01:32
  • chromedriver work for me by command line – Fathy Jul 20 '17 at 13:56

2 Answers2

0

driver should be updated one & did u try webdriver.Firefox(driver_path) ?

jaibalaji
  • 3,159
  • 2
  • 15
  • 28
  • i edit the question because your solution give me a error too – Fathy Jul 20 '17 at 13:59
  • looks like your adding chrome driver path for Firefox module. add geckodriver for firefox. for more info visit : https://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path – jaibalaji Jul 23 '17 at 12:27
  • thanks man its work by version geckodriver-v0.18.0-linux32.tar.gz and the path to extract geckdriver was '\usr\local\bin' – Fathy Jul 23 '17 at 13:03
  • Great News !!! Can you Accept the Answer by clicking on the tick mark beside my Answer, just below vote Up/Down arrows, so the tick mark turns Green? Thanks – jaibalaji Jul 26 '17 at 14:12
0

Uninstall instance of webdriver dependency and install the correct one which corresponds to your OS and browser version.Also when you give path of chrome ,it should end with chrome.exe and not chrome.

Rakesh
  • 24
  • 5
  • dear its linux there's no such thing like chrome.exe and i did that read the question clearly – Fathy Jul 21 '17 at 09:54