0

当我尝试使用 chrome 无头浏览器时出现以下错误。我无法找到正确的错误

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

错误跟踪:

kumar@testubun16:~$ sudo python test.py Traceback (most recent call last):   File "test.py", line 6, in <module>
    driver = webdriver.Chrome()   File "/home/kumar/.local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)   File "/home/kumar/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)   File "/home/kumar/.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/kumar/.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/kumar/.local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 408, in execute
    return self._request(command_info[0], url, body=data)   File "/home/kumar/.local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 440, 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: ''
4

0 回答 0