openatx / facebook-wda

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

调用s.swipe函数的时候会报连接错误,请问是为什么呢? #75

Open WeihaoZ opened 5 years ago

WeihaoZ commented 5 years ago

我已经pip install -U --pre facebook-wda更新过了,执行s.swipe(0.5, 0.5, 0.5, 0.0)时还是会报以下错误:

Shell: curl -X GET -d '' 'http://localhost:8100/session/6F114946-557A-4CC1-974D-8D35CC4AE402/window/size'
Return (2226ms): {
  "value" : {
    "width" : 375,
    "height" : 667
  },
  "sessionId" : "6F114946-557A-4CC1-974D-8D35CC4AE402"
}
Shell: curl -X POST -d '{"fromX": 187, "fromY": 333, "toX": 187, "toY": 0, "duration": 0}' 'http://localhost:8100/session/6F114946-557A-4CC1-974D-8D35CC4AE402/wda/dragfromtoforduration'
error
Traceback (most recent call last):
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1321, in getresponse
    response.begin()
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 296, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 265, 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 "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/urllib3/util/retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1321, in getresponse
    response.begin()
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 296, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 265, 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 "h5.py", line 77, in h5_adapter_ios
    s.swipe(0.5, 0.5, 0.5, 0.0)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wda/__init__.py", line 592, in swipe
    return self.http.post('/wda/dragfromtoforduration', data=data)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wda/__init__.py", line 144, in fetch
    return self._fetch_no_alert(method, url, data)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wda/__init__.py", line 150, in _fetch_no_alert
    return httpdo(target_url, method, data)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wda/__init__.py", line 106, in httpdo
    timeout=HTTP_TIMEOUT)
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/uiauto/Library/Python/3.7/lib/python/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/Users/uiauto/Library/Python/3.7/lib/python/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'))
Shell: curl -X DELETE -d '' 'http://localhost:8100/session/6F114946-557A-4CC1-974D-8D35CC4AE402'
Return (4924ms): {
  "value" : null,
  "sessionId" : "C91C48CF-CA96-4DE8-A2CF-3E7D6DDB8D0D"
}
codeskyblue commented 5 years ago

是不是不让出现0坐标

Sent with GitHawk

WeihaoZ commented 5 years ago

是不是不让出现0坐标

Sent with GitHawk

不是,试了下s.swipe(0.5, 0.5, 0.5, 0.1)也是同样的错误

codeskyblue commented 5 years ago

那你试试升级下 xcode的WebDriverAgent试试,我试了下最新版的 https://github.com/appium/WebDriverAgent是ok的

codeskyblue commented 5 years ago

@WeihaoZ 你这个好像跟iproxy有关系,听说有一个版本的iproxy连接时间超过5s就会断开