openatx / facebook-wda

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

Source function is not able to get 'XML' elements and it is hitting the timeout of 30 seconds and crashing if a page contains lot of 'XML' elements. #110

Open sandamoni opened 3 years ago

sandamoni commented 3 years ago

Hello,

I am using your library. One of the page in the application I am using has a lot of 'XML' elements and I was trying to use the source method in BaseClient class to retrieve xml elements. I am getting timeout error since the connection timeout in the class is set to 30.0 seconds. Can you please provide an API/customizable timeout method to customize the timeout according to user needs.

I was able to write a function and change timeout for now. Thanks.

sandamoni commented 3 years ago

Change timeout also is crashing the app most times. It works only sometimes. To give you a scale of XML element characters I am trying to read through 'source' method. Characters: 153300, Line breaks : 1000.

Traceback (most recent call last): File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen chunked=chunked) File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 384, in _make_request six.raise_from(e, None) File "", line 2, in raise_from File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request httplib_response = conn.getresponse() File "C:\Python37\lib\http\client.py", line 1344, in getresponse response.begin() File "C:\Python37\lib\http\client.py", line 306, in begin version, status, reason = self._read_status() File "C:\Python37\lib\http\client.py", line 275, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Python37\lib\site-packages\requests\adapters.py", line 449, in send timeout=timeout File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "C:\Python37\lib\site-packages\urllib3\util\retry.py", line 368, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Python37\lib\site-packages\urllib3\packages\six.py", line 685, in reraise raise value.with_traceback(tb) File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen chunked=chunked) File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 384, in _make_request six.raise_from(e, None) File "", line 2, in raise_from File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request httplib_response = conn.getresponse() File "C:\Python37\lib\http\client.py", line 1344, in getresponse response.begin() File "C:\Python37\lib\http\client.py", line 306, in begin version, status, reason = self._read_status() File "C:\Python37\lib\http\client.py", line 275, in _read_status raise RemoteDisconnected("Remote end closed connection without" urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Python37\lib\site-packages\wda\utils.py", line 47, in _inner return fn(*args, kwargs) File "C:\Python37\lib\site-packages\wda__init__.py", line 460, in _fetch response = httpdo(url, method, data, timeout) File "C:\Python37\lib\site-packages\wda__init.py", line 130, in httpdo return _unsafe_httpdo(url, method, data, timeout) File "C:\Python37\lib\site-packages\wda\init__.py", line 160, in _unsafe_httpdo timeout=timeout) File "C:\Python37\lib\site-packages\requests\sessions.py", line 530, in request resp = self.send(prep, send_kwargs) File "C:\Python37\lib\site-packages\requests\sessions.py", line 643, in send r = adapter.send(request, **kwargs) File "C:\Python37\lib\site-packages\requests\adapters.py", line 498, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))