Appium Appium 跑 UI 自动化的时候经常碰到 urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected ('Remote end closed connection without response'))

Just Tester · 2019年10月15日 · 最后由 mackle 回复于 2020年11月20日 · 7850 次阅读

大家有没有遇到这个问题?请问如何 fix?谢谢大家

报错信息如下:

ft3.1: Traceback (most recent call last):
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 603, in urlopen
chunked=chunked)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 387, in _make_request
six.raise_from(e, None)
File "", line 2, in raise_from
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 1321, in getresponse
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 296, in begin
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 265, in _read_status
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File ".\test_cases\station_list_check.py", line 31, in test_check_station_list
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\selenium\webdriver\remote\webdriver.py", line 360, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\appium\webdriver\webdriver.py", line 276, in find_element
'value': value})['value']
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\selenium\webdriver\remote\webdriver.py", line 319, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\selenium\webdriver\remote\remote_connection.py", line 374, in execute
return self._request(command_info[0], url, body=data)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\selenium\webdriver\remote\remote_connection.py", line 397, in _request
resp = self._conn.request(method, url, body=body, headers=headers)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\request.py", line 72, in request
**urlopen_kw)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\request.py", line 150, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\poolmanager.py", line 326, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\util\retry.py", line 368, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\packages\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 603, in urlopen
chunked=chunked)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 387, in _make_request
six.raise_from(e, None)
File "", line 2, in raise_from
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 1321, in getresponse
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 296, in begin
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 265, in _read_status
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Traceback (most recent call last):
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 603, in urlopen
chunked=chunked)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 387, in _make_request
six.raise_from(e, None)
File "", line 2, in raise_from
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 1321, in getresponse
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 296, in begin
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 265, in _read_status
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File ".\test_cases\station_list_check.py", line 31, in test_check_station_list
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\selenium\webdriver\remote\webdriver.py", line 360, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\appium\webdriver\webdriver.py", line 276, in find_element
'value': value})['value']
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\selenium\webdriver\remote\webdriver.py", line 319, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\selenium\webdriver\remote\remote_connection.py", line 374, in execute
return self._request(command_info[0], url, body=data)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\selenium\webdriver\remote\remote_connection.py", line 397, in _request
resp = self._conn.request(method, url, body=body, headers=headers)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\request.py", line 72, in request
**urlopen_kw)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\request.py", line 150, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\poolmanager.py", line 326, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\util\retry.py", line 368, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\packages\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 603, in urlopen
chunked=chunked)
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 387, in _make_request
six.raise_from(e, None)
File "", line 2, in raise_from
File "C:\Users\WCHENG20\Desktop\python\python-3.7.3-embed-amd64\urllib3\connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 1321, in getresponse
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 296, in begin
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\client.py", line 265, in _read_status
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

共收到 10 条回复 时间 点赞

求助求助

源码贴一下

换成 linux 的系统,然后增加一个失败重复执行的功能

wtnhz #3 回复

为什么要换成 Linux?我这边是 Windows 机器,换不了,有什么解决办法吗?

小断腿 #2 回复

和代码好像没啥关系,我这边有的时候跑着跑着就会遇到这个问题。

wtnhz #3 回复

失败重跑,pytest?

求教大家怎么解决这个问题???

求教大家如何解决这个问题。

楼主这个问题解决了嘛,可真头疼

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册