从硒打开浏览器时出错



my script

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/"中 就像假设的那样, 它没有帮助
,并且对壁虎司机也做了同样的事情 使用 python3(linux( 设置 Selenium 时遇到问题

什么都不起作用相同的错误

我试试这个镜头

#!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 版本, 火狐和硒是最新的

驱动程序应该更新一个,你试过网络驱动程序吗?火狐(driver_path( ?

卸载 Web 驱动程序依赖项的实例并安装与您的操作系统和浏览器版本相对应的正确实例。此外,当您给出铬的路径时,它应该以铬结尾.exe而不是铬。

相关内容

  • 没有找到相关文章

最新更新