有一段如题所示的错误,而且这个错误提示每次都不同(触发错误的代码所在行数)。
而我昨天睡觉前还能成功运行。这个错误似乎是随机的...
这是一段 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
为什么会出现随机的错误呢...糟心。
1
gulu OP 这个错误是因为浏览器在测试期间过早关闭造成的。
从 firefox driver 切换到 chrome driver 后问题消失。 |
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 |