selenium:找不到Chrome二进制文件?

时间:2014-04-08 19:28:12

标签: python selenium splinter

当尝试使用Python的Splinter库使用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.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)'

whereis chromedriver

chromedriver: /usr/bin/chromedriver /usr/bin/X11/chromedriver /usr/local/bin/chromedriver

Code I尝试运行:

from splinter import Browser

browser = Browser('chrome')

我到处都看,但没有关于如何在Splinter中指定特定路径的内容。我尝试应用一些硒实例,但它没有用。

0 个答案:

没有答案