环境:
问题说明:
铬版本为“ Chromium 71.0.3545.0稳定”,并且我的板上没有google-chrome。 lrwxrwxrwx 1根根34 Nov 29 00:14 / usr / bin / chromium-> / usr / lib / chromium / chromium-wrapper
我下载了“ ChromeDriver 2.45”->“ chromedriver_linux64.zip”,其中说 “支持Chrome v70-72”,解压缩并将“ chromedriver”放入/ usr / bin
然后我按照以下步骤进行操作,并得到了这样的错误
Python 2.7.15 (default, Nov 26 2018, 01:36:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium.webdriver.chrome.options import Options
>>> from selenium import webdriver
>>> opts=Options()
>>> opts.binary_location="/usr/bin/chromedriver"
>>> driver=webdriver.Chrome(chrome_options=opts)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-p
packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/usr/lib/python2.7/site-
packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
答案 0 :(得分:0)
在目标板上使用嵌入式linux系统和 Chromium 71.0 而不是"ChromeDriver 2.45" ->"chromedriver_linux64.zip"
时,您需要下载 chromedriver-v2.21- link中的linux-armv7l ,并在程序中使用它,如下所示:
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
opts=Options()
opts.binary_location='/path/to/chrome' #Chromium 71.0 executable binary
driver = webdriver.Chrome(chrome_options=opts, executable_path='/path/to/chromedriver.exe')
您可以在以下位置找到一些相关的讨论