在ubuntu 16.04中的driver = webdriver.Chrome()pyvirtualdisplay和selenium包中出错

时间:2016-10-18 05:10:50

标签: python-2.7 selenium ubuntu-16.04

我在Ubuntu 16.04中安装了pyvirtualdisplay和selenium软件包。 我想从网页上获取数据。 我试过这段代码,

from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0, size=(800, 600))
display.start()
driver = webdriver.Chrome()
driver.get('http://christopher.su')
print driver.title 

但是当我运行' driver = webdriver.Chrome()'我收到了这个错误,

>>> driver = webdriver.Chrome()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nextremer/.local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/home/nextremer/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/nextremer/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/home/nextremer/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/home/nextremer/.local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 407, in execute
    return self._request(command_info[0], url, body=data)
  File "/home/nextremer/.local/lib/python2.7/site-packages/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)
httplib.BadStatusLine: ''

0 个答案:

没有答案