[英]Selenium Firefox driver raise exception OSError: [Errno 8] Exec format error
def setUp(self):
display = Xvfb()
display.start()
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList",2)
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/csv")
self.browser= webdriver.Firefox(firefox_profile=fp)
On webdriver.firefox
it raises an exception even I tried with geckodriver path 在
webdriver.firefox
,即使我尝试使用geckodriver路径,它也会引发异常
self.browser=webdriver.Firefox(executable_path='/usr/bin/geckodriver',firefox_profile=fp)
But still it raises an exception 但它仍然引发一个例外
Traceback (most recent call last):
File "fbCampaign.py", line 23, in setUp
self.browser= webdriver.Firefox(executable_path='/usr/bin/geckodriver',firefox_profile=fp)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 157, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
This error message... 此错误消息...
OSError: [Errno 8] Exec format error
...means the geckodriver binary which you are trying to use was compiled for a different platform. ...表示您要使用的geckodriver二进制文件是针对其他平台编译的。
Download the GeckoDriver binary specific to your platform (Windows, Mac, Linux) from GeckoDriver Release Repository . 从GeckoDriver发行资料库下载特定于您的平台(Windows,Mac,Linux)的GeckoDriver二进制文件。
You must choose the correct GeckoDriver binary to match the underlying OS it will be run on: 您必须选择正确的GeckoDriver二进制文件以匹配将在其上运行的基础操作系统:
geckodriver-v0.22.0-linux32.tar.gz
: For Linux OS. geckodriver-v0.22.0-linux32.tar.gz
:对于Linux操作系统。 geckodriver-v0.22.0-macos.tar.gz
: For MAC OSX. geckodriver-v0.22.0-macos.tar.gz
:对于MAC OSX。 geckodriver-v0.22.0-win32.zip
: For Windows 32-bit OS. geckodriver-v0.22.0-win32.zip
:对于Windows 32位操作系统。 geckodriver-v0.22.0-win64.zip
: For Windows 64-bit OS. geckodriver-v0.22.0-win64.zip
:对于Windows 64位操作系统。 Note : Once you download you need to unzip / untar the GeckoDriver binary. 注意 :下载后,您需要解压缩 / 解压缩 GeckoDriver二进制文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.