Man*_*nny 5 python selenium chromium selenium-chromedriver
所以我试图使用Chromium在我的覆盆子pi上运行Selenium,由于某种原因我无法编译我的python文件.我一直收到以下错误:
Traceback (most recent call last):
File "test.py", line 4, in <module>
driver = webdriver.Chrome(os.path.expanduser('/usr/bin/chromedriver.exe'))
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/service.py", line 75, in start
os.path.basename(self.path), docs_msg)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Run Code Online (Sandbox Code Playgroud)
这是我正在尝试运行的python代码:
from selenium import webdriver
import os
driver = webdriver.Chrome(os.path.expanduser('/usr/bin/chromedriver'))
driver.get("http://www.google.com")
driver.quit()
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
更新
在chromedriver结束时删除'.exe'后,它现在产生以下错误:
Traceback (most recent call last):
File "test.py", line 4, in <module>
driver = webdriver.Chrome(os.path.expanduser('/usr/bin/chromedriver'))
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/service.py", line 68, in start
self.service_args, env=env, stdout=PIPE, stderr=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
Run Code Online (Sandbox Code Playgroud)
Ubuntu 将 chromium-chromedriver 构建为 armhf 的 .deb 文件。
因此,在启动板上,您可以找到可供下载的chromium-chromedriver armhf 版本。只需下载最新版本,由于它们没有依赖项,因此您可以通过运行来安装dpkg -i chromium-chromedriver_58.0.3029.96-0ubuntu0.14.04.1174_armhf.deb。然后 chromedriver 将在/usr/lib/chromium-browser/chromedriver.
| 归档时间: |
|
| 查看次数: |
9740 次 |
| 最近记录: |