硒铬驱动程序httplib.badstatusline [英] selenium chrome driver httplib.badstatusline
问题描述
我使用以下教程安装硒,铬,pyvritualdisplay和xvfb: https://christopher.su/2015/selenium-chromedriver-ubuntu/ >
当我尝试运行python硒脚本时,我在调用webdriver.Chrome()时收到此错误
我正在使用python2.7.6 在Ubuntu 14.04.3 LTS上
Traceback (most recent call last):
File "selenium_python_unittests/attempt_50.py", line 9, in <module>
driver = webdriver.Chrome()
File "/home/sele/headless/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/home/sele/headless/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/sele/headless/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/sele/headless/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/sele/headless/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/sele/headless/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 1051, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 415, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 379, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ''
有什么主意吗?这对我来说没有任何意义,因为这种异常发生在我向网站提出网络请求之前
driver.get('http://christopher.su')
正在使用chrome驱动程序的过时版本.
如果出现此问题,请检查您是否使用了chromedriver和chrome浏览器的最新更新.并确保您使用的是python2 +
谢谢.
I install selenium, chrome, pyvritualdisplay and xvfb using the following tutorial: https://christopher.su/2015/selenium-chromedriver-ubuntu/
when i try to run a python selenium script i get this error when i call webdriver.Chrome()
I'm using python2.7.6 on Ubuntu 14.04.3 LTS
Traceback (most recent call last):
File "selenium_python_unittests/attempt_50.py", line 9, in <module>
driver = webdriver.Chrome()
File "/home/sele/headless/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/home/sele/headless/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/sele/headless/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/sele/headless/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/sele/headless/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/sele/headless/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 1051, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 415, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 379, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ''
Any idea? This doesn't make any sense to me, because this exception happens before I even make a web request to a website
driver.get('http://christopher.su')
Was using an outdated version of chrome driver.
If have this issue, please check if your using latest update of the chromedriver, and the chrome browser. and be sure your using python2+
Thank You.
这篇关于硒铬驱动程序httplib.badstatusline的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!