V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
gulu
V2EX  ›  Python

随机错误: Remote end closed connection without response

  •  
  •   gulu · 2016-06-23 11:19:00 +08:00 · 8725 次点击
    这是一个创建于 2878 天前的主题,其中的信息可能已经有所发展或是发生改变。

    有一段如题所示的错误,而且这个错误提示每次都不同(触发错误的代码所在行数)。
    而我昨天睡觉前还能成功运行。这个错误似乎是随机的...
    这是一段 functional_test 代码,使用 selenium 测试网站。
    在看 TDD with Python 这本书。

    Traceback (most recent call last):
      File "/home/john/django/superlists/functional_tests/tests.py", line 42, in test_01_can_start_a_list_and_retrieve_it_later
        inputbox.send_keys(Keys.ENTER)
      File "/home/john/django/env/lib/python3.5/site-packages/selenium/webdriver/remote/webelement.py", line 321, in send_keys
        self._execute(Command.SEND_KEYS_TO_ELEMENT, {'value': keys_to_typing(value)})
      File "/home/john/django/env/lib/python3.5/site-packages/selenium/webdriver/remote/webelement.py", line 456, in _execute
        return self._parent.execute(command, params)
      File "/home/john/django/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
        response = self.command_executor.execute(driver_command, params)
      File "/home/john/django/env/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
        return self._request(command_info[0], url, body=data)
      File "/home/john/django/env/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 432, in _request
        resp = self._conn.getresponse()
      File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
        response.begin()
      File "/usr/lib/python3.5/http/client.py", line 297, in begin
        version, status, reason = self._read_status()
      File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
        raise RemoteDisconnected("Remote end closed connection without"
    http.client.RemoteDisconnected: Remote end closed connection without response
    

    为什么会出现随机的错误呢...糟心。

    2 条回复    2016-08-04 18:52:04 +08:00
    gulu
        1
    gulu  
    OP
       2016-06-25 14:39:54 +08:00 via Android
    这个错误是因为浏览器在测试期间过早关闭造成的。
    从 firefox driver 切换到 chrome driver 后问题消失。
    shady
        2
    shady  
       2016-08-04 18:52:04 +08:00
    可以看一下这个链接: http://stackoverflow.com/questions/37761668/cant-open-browser-with-selenium-after-firefox-update
    我也是最近遇到这问题, 主要是 firefox 升级后引起的, 已经解决了。
    相关链接还有: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver#Setting_up_the_Marionette_executable
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3407 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 419ms · UTC 11:12 · PVG 19:12 · LAX 04:12 · JFK 07:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.