Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行iOS时莫名卡住,断连,问题几乎是必现 #1245

Open
lanchuanshuang opened this issue Sep 6, 2024 · 0 comments
Open

运行iOS时莫名卡住,断连,问题几乎是必现 #1245

lanchuanshuang opened this issue Sep 6, 2024 · 0 comments

Comments

@lanchuanshuang
Copy link

在运行iOS设备时,大概运行10-20分钟左右就会莫名卡住,手机wda还是开启状态,看向像是与手机的通讯无响应了,问题出现非常频繁,而且每次时间还几乎一致,我用的是Pytest框架运行的
报错代码:
if exists(Template(r"tpl1722846443329.png", record_pos=(-0.43, -0.942), resolution=(1125, 2436))):
touch(Template(r"tpl1722846443329.png", record_pos=(-0.43, -0.942), resolution=(1125, 2436)))
else:
if poco(name="Add Address"):
poco(name="Add Address").click()
time.sleep(0.5)
os.makedirs(os.path.dirname(f"{file_name}/{app_name}/Address_Management2.png"),
exist_ok=True)

                  snapshot(filename=f"{file_name}/{app_name}/Address_Management2.png")

pytest的部分日志如下:
self = <wda.usbmux.Device object at 0x000002268F92FF70>

def create_inner_connection(self, port: int = 0xf27e) -> PlistSocket:
    # I really donot know why do this
    # The following code convert port(0x1234) to port(0x3412)
    _port = ((port & 0xff) << 8) | (port >> 8)
    logger.debug("port convert %s(%d) -> %s(%d)", hex(port), port,
                 hex(_port), _port)
    _original_port = port
    del (port)

    device_id = self.info['DeviceID']
    conn = self._usbmux.create_connection()
    payload = {
        'DeviceID': device_id,  # Required
        'MessageType': 'Connect',  # Required
        'PortNumber': _port,  # Required
        'ProgName': PROGRAM_NAME,
    }
    logger.debug("Send payload: %s", payload)
    data = conn.send_recv_packet(payload)
    logger.debug("connect port: %d", _port)
    if 'Number' in data and data['Number'] != 0:
        err_code = data['Number']
        if err_code == 3:
          raise MuxConnectError(
                "device port:{} is not ready".format(_original_port))

E wda.exceptions.MuxConnectError: device port:8100 is not ready

D:\ui.venv\lib\site-packages\urllib3\connectionpool.py:392: in _make_request
conn.request(method, url, **httplib_request_kw)
....\AppData\Local\Programs\Python\Python39\lib\http\client.py:1285: in request
self._send_request(method, url, body, headers, encode_chunked)
....\AppData\Local\Programs\Python\Python39\lib\http\client.py:1331: in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
....\AppData\Local\Programs\Python\Python39\lib\http\client.py:1280: in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
....\AppData\Local\Programs\Python\Python39\lib\http\client.py:1040: in _send_output
self.send(msg)
....\AppData\Local\Programs\Python\Python39\lib\http\client.py:980: in send
self.connect()
D:\ui.venv\lib\site-packages\wda\requests_usbmux.py:54: in connect
conn = _device.create_inner_connection(int(port))
Airtest的html报告无任何异常,看样子很像是request请求超时了
手机是iPhoneX,系统是15.7,airtest是1.3.4,python是3.9,requests是2.28.0,数据线也换成苹果原创的了,不起作用
这个问题出现的太频繁了,有没有知道的大佬可以帮忙解答一下,谢谢!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant