Python 硒:未找到铬二进制文件?
尝试使用Splinter library for Python在带有chrome浏览器的selenium框架上运行简单测试时,我遇到以下问题:Python 硒:未找到铬二进制文件?,python,selenium,splinter,Python,Selenium,Splinter,尝试使用Splinter library for Python在带有chrome浏览器的selenium框架上运行简单测试时,我遇到以下问题: Traceback (most recent call last): File "chrome.py", line 3, in <module> browser = Browser('chrome') File "/usr/local/lib/python2.7/dist-packages/splinter/browser.p
Traceback (most recent call last):
File "chrome.py", line 3, in <module>
browser = Browser('chrome')
File "/usr/local/lib/python2.7/dist-packages/splinter/browser.py", line 53, in Browser
return driver(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/splinter/driver/webdriver/chrome.py", line 23, in __init__
self.driver = Chrome(chrome_options=options, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 65, in __init__
keep_alive=True)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'unknown error: cannot find Chrome binary\n (Driver info: chromedriver=2.9.248316,platform=Linux 3.2.0-24-virtual x86)'
我正在尝试运行的代码:
from splinter import Browser
browser = Browser('chrome')
我到处都找过,但没有找到如何在Splinter中指定特定路径的方法。我尝试应用了一些selenium示例,但没有成功。此url可能会帮助您进行设置:或者检查这个问题,我正在再次尝试。使用sudo-apt-get-update和sudo-apt-get-install-openjdk-7-jdk,https://raw.githubusercontent.com/cobrateam/splinter/master/.travis_before.bash,将其替换为最新的chromedriver。
from splinter import Browser
browser = Browser('chrome')