在使用Python完成selenium测试后抛出[HTTPError:HTTP错误503:服务不可用]错误

时间:2014-03-06 12:44:19

标签: python python-2.7 selenium selenium-webdriver

 self.driver.quit()
  File "C:\Python27\lib\site-packages\selenium-2.40.0-py2.7.egg\selenium\webdriver\chrome\webdriver.py", line 82, in quit
    self.service.stop()
  File "C:\Python27\lib\site-packages\selenium-2.40.0-py2.7.egg\selenium\webdriver\chrome\service.py", line 97, in stop
    url_request.urlopen("http://127.0.0.1:%d/shutdown" % self.port)
  File "C:\Python27\lib\urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 410, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

HTTPError: HTTP Error 503: Service Unavailable

2 个答案:

答案 0 :(得分:5)

这种情况是否只发生在Chrome上?我遇到了一个产生完全相同的堆栈跟踪的similar issue(尽管有407而不是503),所以我很想知道相同的解决方案是否有帮助。

导航到控制面板>互联网选项> “连接”标签> LAN设置>高级。然后,将127.0.0.1插入“例外”框。在我的情况下,这足以防止在调用.quit()时崩溃。

答案 1 :(得分:2)

这是Chrome浏览器上的一个问题。以下步骤将为您提供修复。

1 |取消选中复选框By Proxy server for local address

enter image description here

2 |单击“高级选项卡”

enter image description here

3 |在“例外”面板

下输入127.0.0.1

4 |点击确定

相关问题