Fix: [ALAS] Patch u2.init.appdir in runtime

This commit is contained in:
LmeSzinc 2024-04-29 23:41:32 +08:00
parent 3179cdc81d
commit 6818a9d86c

View File

@ -1,3 +1,4 @@
import os
import random
import re
import socket
@ -5,6 +6,7 @@ import time
import typing as t
import uiautomator2 as u2
import uiautomator2cache
from adbutils import AdbTimeout
from lxml import etree
@ -51,6 +53,9 @@ from module.logger import logger
RETRY_TRIES = 5
RETRY_DELAY = 3
# Patch uiautomator2 appdir
u2.init.appdir = os.path.dirname(uiautomator2cache.__file__)
def is_port_using(port_num):
""" if port is using by others, return True. else return False """