不能使用splinter构建chrome浏览器。 badstatusline

时间:2016-12-20 09:46:04

标签: python selenium-chromedriver

这应该可以正常使用

from splinter import Browser
browser = Browser('chrome')

但这种情况发生了:

  File ""/home/sheena/Workspace/Waxed/venv_bi/local/lib/python2.7/site-packages/splinter/browser.py"", line 63, in Browser
    return driver(*args, **kwargs)
  File ""/home/sheena/Workspace/Waxed/venv_bi/local/lib/python2.7/site-packages/splinter/driver/webdriver/chrome.py"", line 31, in __init__
    self.driver = Chrome(chrome_options=options, **kwargs)
  File ""/home/sheena/Workspace/Waxed/venv_bi/lib/python2.7/site-packages/selenium-3.0.1-py2.7.egg/selenium/webdriver/chrome/webdriver.py"", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File ""/home/sheena/Workspace/Waxed/venv_bi/lib/python2.7/site-packages/selenium-3.0.1-py2.7.egg/selenium/webdriver/remote/webdriver.py"", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File ""/home/sheena/Workspace/Waxed/venv_bi/lib/python2.7/site-packages/selenium-3.0.1-py2.7.egg/selenium/webdriver/remote/webdriver.py"", line 179, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File ""/home/sheena/Workspace/Waxed/venv_bi/lib/python2.7/site-packages/selenium-3.0.1-py2.7.egg/selenium/webdriver/remote/webdriver.py"", line 234, in execute
    response = self.command_executor.execute(driver_command, params)
  File ""/home/sheena/Workspace/Waxed/venv_bi/lib/python2.7/site-packages/selenium-3.0.1-py2.7.egg/selenium/webdriver/remote/remote_connection.py"", line 407, in execute
    return self._request(command_info[0], url, body=data)
  File ""/home/sheena/Workspace/Waxed/venv_bi/lib/python2.7/site-packages/selenium-3.0.1-py2.7.egg/selenium/webdriver/remote/remote_connection.py"", line 439, in _request
    resp = self._conn.getresponse()
  File ""/usr/lib/python2.7/httplib.py"", line 1136, in getresponse
    response.begin()
  File ""/usr/lib/python2.7/httplib.py"", line 453, in begin
    version, status, reason = self._read_status()
  File ""/usr/lib/python2.7/httplib.py"", line 417, in _read_status
    raise BadStatusLine(line)
BadStatusLine: ''

关于如何解决此问题的任何想法?我已经google了一下,发现绝对没有任何用处。

1 个答案:

答案 0 :(得分:0)

git clone https://github.com/peterhudec/chromedriver_installer.git
cd chromedriver_installer/
python setup.py install --chromedriver-version=2.25