python - throw [HTTPError : HTTP Error 503: Service Unavailable] Error after the selenium tests are done using Python

标签 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

最佳答案

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

导航到控制面板 > Internet 选项 > 连接选项卡 > LAN 设置 > 高级。然后,将 127.0.0.1 插入异常(exception)框。就我而言,这足以防止调用 .quit() 时发生崩溃。

关于python - throw [HTTPError : HTTP Error 503: Service Unavailable] Error after the selenium tests are done using Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22224945/

相关文章:

python - 使用重写的 __cmp__ 函数实现列表包装器

php - 如何增加 facebook php web-driver 中的 curl 超时

javascript - 如果 URL 以 "blob:"开头,如何使用 Python 3/Selenium 下载图像?

python - 有没有办法使用 Node.js 按计划检索 Google Analytics 4 数据?

python - 如何在 python 中为长名称选择合适的变量名

python - 用于在远程服务器上运行命令的交互式 Python 脚本

python - (OpenCV) 将日期放在文件名中

python - 嵌套字符串格式

python - 从 ctypes windll 获取错误信息

python - Selenium 2.0rc3点击功能太快?