【发布时间】:2017-01-26 18:00:24
【问题描述】:
我是 Python 的初学者,最近偶然发现了 Selenium 模块,如果有人可以帮助我,我将不胜感激?
我似乎无法让 selenium 模块与 python3 一起工作。 我已经下载了 Firefox 的 geckodriver,但仍然没有成功,或者安装不正确?
我正在使用此代码:
从硒导入网络驱动程序
浏览器 = webdriver.Firefox()
并且似乎收到了这个错误:
'OSError: [Errno 8] 执行格式错误'
整个错误消息的副本粘贴在下面。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chron/.local/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 140, in __init__
self.service.start()
File "/home/chron/.local/lib/python3.5/site-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 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
【问题讨论】:
-
geckodriver 在你的
$PATH中吗?我刚刚设置了一个 linux/python3 selenium 应用程序,从未见过这个错误。 -
你是如何从命令行调用你的脚本的?
-
@JaredSmith,缺少 geckodriver 会产生不同的错误