0

I am getting the following error when i try to do chrome headless browser.I am not able to find the proper error

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

Error trace:

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: ''
Naveen Kumar R B
  • 6,248
  • 5
  • 32
  • 65
kumar
  • 8,207
  • 20
  • 85
  • 176
  • without Headless (`Display`), is it working? have you kept your chromedriver in the searchable path? – Naveen Kumar R B Dec 13 '16 at 08:56
  • on my desktop it works. I am trying to run it on a linux vm which does not have a desktop. I basically followed the instruction https://christopher.su/2015/selenium-chromedriver-ubuntu/ – kumar Dec 13 '16 at 10:56
  • what is the bit version of VM, Ubuntu? 32 or 64? check `Footnotes` in the link you shared. You can find all the ChromeDriver releases here. If you’re using a 32-bit system or a non-Linux OS, the ChromeDriver download used above won’t work. – Naveen Kumar R B Dec 13 '16 at 11:02
  • Do you get the same for headless firefox? – boardrider Dec 13 '16 at 20:15

0 Answers0