我下载了 selenium 和 geckodriver 的最新版本。我做了以下事情:
重击
cp Downloads/geckodriver /usr/local/bin/
PATH=$PATH:/usr/local/bin/geckodriver
Python
from selenium import webdriver
browser = webdriver.Firefox()
错误
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/chris/anaconda/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 140, in __init__
self.service.start()
File "/Users/chris/anaconda/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "/Users/chris/anaconda/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/Users/chris/anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
更新
我对 chrome web 驱动程序做了同样的事情:
browser = webdriver.Chrome()
错误
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Mac OS X 10.12.3 x86_64)
这与指定路径有关吗?真的很困惑,因为我对 bash 没有经验