openatx / facebook-wda

Facebook WebDriverAgent Python Client Library (not official)
MIT License
1.72k stars 266 forks source link

Max retries exceeded error. #39

Closed zfdev closed 5 years ago

zfdev commented 6 years ago

我只运行了你的代码示例: import wda c = wda.Client('http://localhost:8100')

就报出了如下错误,不清楚是哪里出了问题 `retry to connect, error: HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by Ne wConnectionError('<urllib3.connection.HTTPConnection object at 0x108572908>: Failed to establish a new connection: [Errno 8] n odename nor servname provided, or not known',)) Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 60, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 745, in getadd rinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen chunked=chunked) File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, inendheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in_send_output self.send(msg) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send self.connect() File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 166, in connect conn = self._new_conn() File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn self, "Failed to establish a new connection: %s" % e) urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x108572908>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 440, in send timeout=timeout File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x108572908>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/wda/init.py", line 70, in httpdo response = requests.request(method, url, data=data, timeout=HTTP_TIMEOUT) File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 508, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x108572908>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 60, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 745, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen chunked=chunked) File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, inrequest self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in_send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, inendheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in_send_output self.send(msg) File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send self.connect() File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 166, in connect conn = self._new_conn() File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn self, "Failed to establish a new connection: %s" % e) urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x10858c080>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known`

gamesguru commented 6 years ago

is there a common reason people run into this at first? also facing this issue.

codeskyblue commented 6 years ago

wda没有启动,或者没跑wdaproxy

gamesguru commented 6 years ago

I have the IntegrationApp and WebDriverAgentRunner-Runner installed. Both are running. I am not using iproxy, just a USB cable.

Interesting to note that macOS has problems with uiautomator2, can't get it to work there. No problem on Linux or Windows. But I also can't get facebook-wda python wrapper working on Linux

codeskyblue commented 6 years ago

why not using iproxy?

gamesguru commented 6 years ago

is presented on the wiki as something used for WiFi and not needed with traditional USB protocol. Can we run it on Linux?

Is there a specific remote and local port pair we should use? I tried both 8100 did not work.

gamesguru commented 6 years ago

getting more or less same problem on mac and Linux. Someone said to use python client with tcprelay.py -t 8100:8100. But where do I download that, or how to add through pip? Thanks.

Here's what I got on macOS

$ ssh root@localhost -p 8101
ssh_exchange_identification: Connection closed by remote host

$ iproxy 8100 8100 55adcd589527d1cafb8bab01ca1636152efdaabf
waiting for connection
accepted connection, fd = 4
Number of available devices == 1
Requesting connecion to device handle == 4 (serial: 55adcd589527d1cafb8bab01ca1636152efdaabf), port 8100
waiting for connection
Error connecting to device!
gamesguru commented 6 years ago

I got it working, sort of. On Linux too. (I am using the most recent WebDriver, will try with the recommended one.) But after a while it says (for example d.home()) recv failed: Resource temporarily unavailable and the python exception for that:

wda.WDAError: WDAError(status=13, value=Error Domain=com.facebook.WebDriverAgent
 Code=1 "Timeout waiting until SpringBoard is visible" UserInfo={NSLocalizedDesc
ription=Timeout waiting until SpringBoard is visible})

with d.status() wda.WDAError: WDAError(status=13, value=Cannot get 'xml' source of the current a pplication)

codeskyblue commented 6 years ago

looks like wda is not working

youran1024 commented 5 years ago

HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10cfaba20>

i receive the same error, i start wda service much times, the resoultion is to change the request defalut keep_alive value to false。 but i don't want to fix wda sdk, and how can i do?

codeskyblue commented 5 years ago

Change requests keep_alive to false ? @youran1024

codeskyblue commented 5 years ago

The issue is too old, reopen it, if it is still an issue.