Selenium Webdriver http.client.BadStatusLine:' '错误?

时间:2015-06-10 20:49:30

标签: firefox python-3.x selenium webdriver

我想让selenium webdriver工作,但即使是这样的简单python脚本:

from selenium import webdriver
driver = webdriver.Firefox()
driver.get('http://www.google.com')
driver.quit()

我得到了:

Traceback (most recent call last):
  File "test.py", line 14, in <module>
    driver.get('http://www.google.com')
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 207, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 193, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 358, in execute
    return self._request(command_info[0], url, body=data)
  File "C:\Python34\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 389, in _request
    resp = self._conn.getresponse()
  File "C:\Python34\lib\http\client.py", line 1171, in getresponse
    response.begin()
  File "C:\Python34\lib\http\client.py", line 351, in begin
    version, status, reason = self._read_status()
  File "C:\Python34\lib\http\client.py", line 321, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: ''

我正在尝试使用所有脚本。 Firefox将打开并尝试打开网站,然后关闭,然后打开另一个Firefox实例,但这是一个全新的空白页面。我目前正在使用最新版本的所有内容。 Firefox 31.7.0 ESR(根据Firefox更新),Selenium 2.46.0和Python 3.4。任何帮助,将不胜感激!

由于

1 个答案:

答案 0 :(得分:0)

使用Firefox稳定版。版本38应该有效。