我打開腳本的瀏覽器錯誤而硒
from selenium import webdriver
o = webdriver.Firefox()
和我得到這個問題
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
我搜索它,我發現這個 OSError: [Errno 8] Exec format error selenium
我得到chromedriver並把它在'/ usr/local/bin /' 就像應該的, 它沒有幫助
,也做了同樣的事情geckodriver Trouble setting up selenium with python3(linux)
什麼工作,同樣的錯誤
和我嘗試這個鏡頭
#!usr/bin/python
#!/usr/bin/env bash
from selenium import webdriver
web = webdriver.Firefox(executable_path="/usr/local/bin/chromedriver")
它給我的錯誤:
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
注意: 操作系統是kali linux SMP Debian 4.9.18-1kali1版本, firefox和selenium是最新的
你可以從命令行運行geckodriver/chromedriver嗎?難道是你試圖在Linux上運行一個Windows可執行文件,或者在一些不支持它的Linux上的ELF可執行文件,或者類似的東西? –
chromedriver通過命令行工作 – Fathy