不能用splinter构建chrome浏览器。巴德斯林

2024-06-02 07:09:51 发布

您现在位置:Python中文网/ 问答频道 /正文

这应该很管用

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: ''

有什么办法可以解决这个问题吗?我在谷歌上搜索了一下,发现完全没有用。你知道吗


Tags: inpyhomevenvlibpackagesseleniumline