uiautodev 0.13.0__py3-none-any.whl → 0.13.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of uiautodev might be problematic. Click here for more details.
- uiautodev/__init__.py +1 -1
- uiautodev/app.py +4 -17
- uiautodev/cli.py +22 -6
- uiautodev/command_proxy.py +2 -2
- uiautodev/common.py +4 -3
- uiautodev/provider.py +1 -1
- uiautodev/router/android.py +1 -1
- {uiautodev-0.13.0.dist-info → uiautodev-0.13.1.dist-info}/METADATA +6 -9
- {uiautodev-0.13.0.dist-info → uiautodev-0.13.1.dist-info}/RECORD +12 -12
- {uiautodev-0.13.0.dist-info → uiautodev-0.13.1.dist-info}/WHEEL +0 -0
- {uiautodev-0.13.0.dist-info → uiautodev-0.13.1.dist-info}/entry_points.txt +0 -0
- {uiautodev-0.13.0.dist-info → uiautodev-0.13.1.dist-info}/licenses/LICENSE +0 -0
uiautodev/__init__.py
CHANGED
uiautodev/app.py
CHANGED
|
@@ -15,20 +15,20 @@ import httpx
|
|
|
15
15
|
import uvicorn
|
|
16
16
|
from fastapi import FastAPI, File, Request, Response, UploadFile, WebSocket
|
|
17
17
|
from fastapi.middleware.cors import CORSMiddleware
|
|
18
|
-
from fastapi.responses import
|
|
18
|
+
from fastapi.responses import FileResponse, JSONResponse, RedirectResponse
|
|
19
19
|
from pydantic import BaseModel
|
|
20
|
-
from rich.logging import RichHandler
|
|
21
20
|
from starlette.websockets import WebSocketDisconnect
|
|
22
21
|
|
|
23
22
|
from uiautodev import __version__
|
|
24
23
|
from uiautodev.common import convert_bytes_to_image, get_webpage_url, ocr_image
|
|
24
|
+
from uiautodev.driver.android import ADBAndroidDriver, U2AndroidDriver
|
|
25
25
|
from uiautodev.model import Node
|
|
26
26
|
from uiautodev.provider import AndroidProvider, HarmonyProvider, IOSProvider, MockProvider
|
|
27
|
-
from uiautodev.driver.android import ADBAndroidDriver, U2AndroidDriver
|
|
28
27
|
from uiautodev.remote.scrcpy import ScrcpyServer
|
|
29
28
|
from uiautodev.router.android import router as android_device_router
|
|
30
29
|
from uiautodev.router.device import make_router
|
|
31
|
-
from uiautodev.router.proxy import make_reverse_proxy
|
|
30
|
+
from uiautodev.router.proxy import make_reverse_proxy
|
|
31
|
+
from uiautodev.router.proxy import router as proxy_router
|
|
32
32
|
from uiautodev.router.xml import router as xml_router
|
|
33
33
|
from uiautodev.utils.envutils import Environment
|
|
34
34
|
|
|
@@ -36,19 +36,6 @@ logger = logging.getLogger(__name__)
|
|
|
36
36
|
|
|
37
37
|
app = FastAPI()
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
def enable_logger_to_console(level):
|
|
41
|
-
_logger = logging.getLogger("uiautodev")
|
|
42
|
-
_logger.setLevel(level)
|
|
43
|
-
_logger.addHandler(RichHandler(enable_link_path=False))
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if os.getenv("UIAUTODEV_DEBUG"):
|
|
47
|
-
enable_logger_to_console(level=logging.DEBUG)
|
|
48
|
-
logger.debug("verbose logger enabled")
|
|
49
|
-
else:
|
|
50
|
-
enable_logger_to_console(level=logging.ERROR)
|
|
51
|
-
|
|
52
39
|
app.add_middleware(
|
|
53
40
|
CORSMiddleware,
|
|
54
41
|
allow_origins=["*"],
|
uiautodev/cli.py
CHANGED
|
@@ -20,6 +20,7 @@ import httpx
|
|
|
20
20
|
import pydantic
|
|
21
21
|
import uvicorn
|
|
22
22
|
from retry import retry
|
|
23
|
+
from rich.logging import RichHandler
|
|
23
24
|
|
|
24
25
|
from uiautodev import __version__, command_proxy
|
|
25
26
|
from uiautodev.command_types import Command
|
|
@@ -38,12 +39,21 @@ HARMONY_PACKAGES = [
|
|
|
38
39
|
"https://public.uiauto.devsleep.com/harmony/hypium-5.0.7.200.tar.gz",
|
|
39
40
|
]
|
|
40
41
|
|
|
42
|
+
|
|
43
|
+
def enable_logger_to_console(level):
|
|
44
|
+
_logger = logging.getLogger("uiautodev")
|
|
45
|
+
_logger.setLevel(level)
|
|
46
|
+
_logger.addHandler(RichHandler(enable_link_path=False))
|
|
47
|
+
|
|
48
|
+
|
|
41
49
|
@click.group(context_settings=CONTEXT_SETTINGS)
|
|
42
50
|
@click.option("--verbose", "-v", is_flag=True, default=False, help="verbose mode")
|
|
43
51
|
def cli(verbose: bool):
|
|
44
52
|
if verbose:
|
|
45
|
-
|
|
53
|
+
enable_logger_to_console(level=logging.DEBUG)
|
|
46
54
|
logger.debug("Verbose mode enabled")
|
|
55
|
+
else:
|
|
56
|
+
enable_logger_to_console(level=logging.INFO)
|
|
47
57
|
|
|
48
58
|
|
|
49
59
|
def run_driver_command(provider: BaseProvider, command: Command, params: list[str] = None):
|
|
@@ -142,7 +152,8 @@ def pip_install(package: str):
|
|
|
142
152
|
@click.option("--reload", is_flag=True, default=False, help="auto reload, dev only")
|
|
143
153
|
@click.option("-f", "--force", is_flag=True, default=False, help="shutdown alrealy runningserver")
|
|
144
154
|
@click.option("-s", "--no-browser", is_flag=True, default=False, help="silent mode, do not open browser")
|
|
145
|
-
|
|
155
|
+
@click.option("--offline", is_flag=True, default=False, help="offline mode, do not use internet")
|
|
156
|
+
def server(port: int, host: str, reload: bool, force: bool, no_browser: bool, offline: bool):
|
|
146
157
|
click.echo(f"uiautodev version: {__version__}")
|
|
147
158
|
if force:
|
|
148
159
|
try:
|
|
@@ -154,8 +165,13 @@ def server(port: int, host: str, reload: bool, force: bool, no_browser: bool):
|
|
|
154
165
|
if platform.system() == 'Windows':
|
|
155
166
|
use_color = False
|
|
156
167
|
|
|
168
|
+
if offline:
|
|
169
|
+
from uiautodev.router.proxy import cache_dir
|
|
170
|
+
cache_dir.mkdir(parents=True, exist_ok=True)
|
|
171
|
+
logger.info("offline mode enabled, cache dir: %s", cache_dir)
|
|
172
|
+
|
|
157
173
|
if not no_browser:
|
|
158
|
-
th = threading.Thread(target=open_browser_when_server_start, args=(f"http://{host}:{port}",))
|
|
174
|
+
th = threading.Thread(target=open_browser_when_server_start, args=(f"http://{host}:{port}", offline))
|
|
159
175
|
th.daemon = True
|
|
160
176
|
th.start()
|
|
161
177
|
uvicorn.run("uiautodev.app:app", host=host, port=port, reload=reload, use_colors=use_color)
|
|
@@ -169,16 +185,16 @@ def shutdown(port: int):
|
|
|
169
185
|
pass
|
|
170
186
|
|
|
171
187
|
|
|
172
|
-
def open_browser_when_server_start(
|
|
188
|
+
def open_browser_when_server_start(local_server_url: str, offline: bool = False):
|
|
173
189
|
deadline = time.time() + 10
|
|
174
190
|
while time.time() < deadline:
|
|
175
191
|
try:
|
|
176
|
-
httpx.get(f"{
|
|
192
|
+
httpx.get(f"{local_server_url}/api/info", timeout=1)
|
|
177
193
|
break
|
|
178
194
|
except Exception as e:
|
|
179
195
|
time.sleep(0.5)
|
|
180
196
|
import webbrowser
|
|
181
|
-
web_url = get_webpage_url()
|
|
197
|
+
web_url = get_webpage_url(local_server_url if offline else None)
|
|
182
198
|
logger.info("open browser: %s", web_url)
|
|
183
199
|
webbrowser.open(web_url)
|
|
184
200
|
|
uiautodev/command_proxy.py
CHANGED
|
@@ -13,8 +13,8 @@ from typing import Callable, Dict, List, Optional, Union
|
|
|
13
13
|
from pydantic import BaseModel
|
|
14
14
|
|
|
15
15
|
from uiautodev.command_types import AppLaunchRequest, AppTerminateRequest, By, Command, CurrentAppResponse, \
|
|
16
|
-
DumpResponse, FindElementRequest, FindElementResponse, InstallAppRequest, InstallAppResponse, SendKeysRequest,
|
|
17
|
-
WindowSizeResponse
|
|
16
|
+
DumpResponse, FindElementRequest, FindElementResponse, InstallAppRequest, InstallAppResponse, SendKeysRequest, \
|
|
17
|
+
TapRequest, WindowSizeResponse
|
|
18
18
|
from uiautodev.driver.base_driver import BaseDriver
|
|
19
19
|
from uiautodev.exceptions import ElementNotFoundError
|
|
20
20
|
from uiautodev.model import AppInfo, Node
|
uiautodev/common.py
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import io
|
|
9
9
|
import locale
|
|
10
10
|
import logging
|
|
11
|
-
from typing import List
|
|
11
|
+
from typing import List, Optional
|
|
12
12
|
|
|
13
13
|
from PIL import Image
|
|
14
14
|
|
|
@@ -26,8 +26,9 @@ def is_chinese_language() -> bool:
|
|
|
26
26
|
return False
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
def get_webpage_url() -> str:
|
|
30
|
-
|
|
29
|
+
def get_webpage_url(web_url: Optional[str] = None) -> str:
|
|
30
|
+
if not web_url:
|
|
31
|
+
web_url = "https://uiauto.dev"
|
|
31
32
|
# code will be enabled until uiauto.devsleep.com is ready
|
|
32
33
|
# if is_chinese_language():
|
|
33
34
|
# web_url = "https://uiauto.devsleep.com"
|
uiautodev/provider.py
CHANGED
|
@@ -11,7 +11,7 @@ from typing import Type
|
|
|
11
11
|
|
|
12
12
|
import adbutils
|
|
13
13
|
|
|
14
|
-
from uiautodev.driver.android import
|
|
14
|
+
from uiautodev.driver.android import ADBAndroidDriver, U2AndroidDriver
|
|
15
15
|
from uiautodev.driver.base_driver import BaseDriver
|
|
16
16
|
from uiautodev.driver.harmony import HDC, HarmonyDriver
|
|
17
17
|
from uiautodev.driver.ios import IOSDriver
|
uiautodev/router/android.py
CHANGED
|
@@ -6,7 +6,7 @@ from typing import Dict, Optional
|
|
|
6
6
|
from fastapi import APIRouter, Request, Response
|
|
7
7
|
from pydantic import BaseModel
|
|
8
8
|
|
|
9
|
-
from uiautodev.driver.android import
|
|
9
|
+
from uiautodev.driver.android import ADBAndroidDriver, U2AndroidDriver
|
|
10
10
|
from uiautodev.model import ShellResponse
|
|
11
11
|
|
|
12
12
|
logger = logging.getLogger(__name__)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uiautodev
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.1
|
|
4
4
|
Summary: Mobile UI Automation, include UI hierarchy inspector, script recorder
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -83,24 +83,20 @@ uiauto.dev
|
|
|
83
83
|
# Default driver is uiautomator2
|
|
84
84
|
# Set the environment variable below to switch to adb driver
|
|
85
85
|
export UIAUTODEV_USE_ADB_DRIVER=1
|
|
86
|
-
|
|
87
|
-
# Set the env to enable DEBUG log
|
|
88
|
-
export UIAUTODEV_DEBUG=1
|
|
89
86
|
```
|
|
90
87
|
|
|
91
88
|
# Offline mode
|
|
92
89
|
|
|
93
|
-
|
|
94
|
-
However, some users have limited network environments or restricted internet access. Therefore, an offline cache mode has been added.
|
|
95
|
-
Create a `cache` directory in the directory where uiautodev starts to activate frontend caching.
|
|
90
|
+
Start with
|
|
96
91
|
|
|
97
92
|
```sh
|
|
98
|
-
|
|
99
|
-
uiautodev
|
|
93
|
+
uiautodev server --offline
|
|
100
94
|
```
|
|
101
95
|
|
|
102
96
|
Visit <http://localhost:20242> once, and then disconnecting from the internet will not affect usage.
|
|
103
97
|
|
|
98
|
+
> All frontend resources will be saved to cache/ dir.
|
|
99
|
+
|
|
104
100
|
# DEVELOP
|
|
105
101
|
|
|
106
102
|
see [DEVELOP.md](DEVELOP.md)
|
|
@@ -111,3 +107,4 @@ see [DEVELOP.md](DEVELOP.md)
|
|
|
111
107
|
|
|
112
108
|
# LICENSE
|
|
113
109
|
[MIT](LICENSE)
|
|
110
|
+
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
uiautodev/__init__.py,sha256=
|
|
1
|
+
uiautodev/__init__.py,sha256=C6Noxhnrb3twftV9aYC0k6qYkF2dsG1Q75iaQhkACIQ,165
|
|
2
2
|
uiautodev/__main__.py,sha256=0WZHyHW-M7FG5RexANNoIB5pkCX8xwQbTnmaOA9Y1kg,176
|
|
3
|
-
uiautodev/app.py,sha256
|
|
3
|
+
uiautodev/app.py,sha256=-uWfrcW4RhZbo8I8yIclD79cs8UqcpKY79LLYIGEa0c,7124
|
|
4
4
|
uiautodev/appium_proxy.py,sha256=yMzPnIDo50hYSaq0g5bXUpgRrFa_849wNa2o7ZpxGNY,1773
|
|
5
5
|
uiautodev/binaries/scrcpy_server.jar,sha256=ojxWWfNsJg8QXAItJ7yz6v_6JgcOe6qe2mbQE3ehrbo,71200
|
|
6
6
|
uiautodev/case.py,sha256=Jk2_5X2F-XIPnGuYTCqOVQiwwchwOhF7uKK5oKv5shg,3919
|
|
7
|
-
uiautodev/cli.py,sha256=
|
|
8
|
-
uiautodev/command_proxy.py,sha256=
|
|
7
|
+
uiautodev/cli.py,sha256=ACH8GrA6JXjj1xEXikHGwkHYtfdv2kxiv2QDj0bK8gE,7071
|
|
8
|
+
uiautodev/command_proxy.py,sha256=zNzX6UkKb8AKdeXV9Nj7i07yKcvObREJGtvO8ID83a4,5446
|
|
9
9
|
uiautodev/command_types.py,sha256=wZa-yQpxzQO79iFMHShJELuZgYJm-yweG-TeSBvzBvs,1867
|
|
10
|
-
uiautodev/common.py,sha256=
|
|
10
|
+
uiautodev/common.py,sha256=1-LhSAx-stmIL1UJLkmdu-jC5Sc8vaq77XJf02zfAWc,1617
|
|
11
11
|
uiautodev/driver/android/__init__.py,sha256=KqAi5RYNDbfeH2I6UMxi7Ye7uKWYLjtDqB6N1yCVyF8,139
|
|
12
12
|
uiautodev/driver/android/adb_driver.py,sha256=Pe-Hf7WRcZ3P4_KTcsAz3Y_5DDcyyQ-MvLBpaj3AhJ8,6910
|
|
13
13
|
uiautodev/driver/android/common.py,sha256=0RbWggmj0lbG46ioGR3NVPKiMCGxNWNDr3Ol6gKmNmY,2079
|
|
@@ -22,13 +22,13 @@ uiautodev/driver/udt/appium-uiautomator2-v5.12.4-light.apk,sha256=cKUVKpqEiGRXOD
|
|
|
22
22
|
uiautodev/driver/udt/udt.py,sha256=p6opbUtYxEGTINIX83F6m2CtzB42iSSBYRv1SjXCEFg,8351
|
|
23
23
|
uiautodev/exceptions.py,sha256=lQI14vshN5qExVE23g2aw5i2fkdQFfLCJj2dO6kVLZw,591
|
|
24
24
|
uiautodev/model.py,sha256=hrqezVn1XFXHyajFxxmoiuGDZoYAodfitWMBzrYgziA,1071
|
|
25
|
-
uiautodev/provider.py,sha256=
|
|
25
|
+
uiautodev/provider.py,sha256=bgBxxRyhF3IEpl06BFaFx4PqYOvIlJ7b5vOoav9dXvw,3186
|
|
26
26
|
uiautodev/remote/android_input.py,sha256=r9y2SxnDw0GhN44emL-2Nz0UasaVaVtzh53hd-LJ710,2445
|
|
27
27
|
uiautodev/remote/harmony_mjpeg.py,sha256=-J2sVfPSTuqN80BelisvwaZAimWxIk9SIzD010q3h7c,8287
|
|
28
28
|
uiautodev/remote/keycode.py,sha256=RHSJVfcNY2pelQd7_tcE6T0j3n8CKBkiku7A2AJZUpk,8097
|
|
29
29
|
uiautodev/remote/scrcpy.py,sha256=JNSwC35f4os-IQW4ixx7ky9clpqRWvA8X_obUkwuOh8,7415
|
|
30
30
|
uiautodev/remote/touch_controller.py,sha256=dYl5XTLaYEyZiNJmKwHQpw9QhPSkN3iUetJSaiQJBHg,4255
|
|
31
|
-
uiautodev/router/android.py,sha256=
|
|
31
|
+
uiautodev/router/android.py,sha256=XPG7UdKfW4A6dLW6MQxOrwUOAOdjaaImtXxs62C_xIg,1384
|
|
32
32
|
uiautodev/router/device.py,sha256=59uSGvOmJKoaf0oC1eQQWhQ4Yvz3-8Cp5bD6_N6e9iI,4290
|
|
33
33
|
uiautodev/router/proxy.py,sha256=zQyZDeSM46fcqkYx8uFzUoY3udi7GUQaJhP3Ybspcco,6990
|
|
34
34
|
uiautodev/router/xml.py,sha256=MKVLhjMBqE4qbEraQxvdrVp_OBnylEL9Wti5lnmBDk4,891
|
|
@@ -37,8 +37,8 @@ uiautodev/utils/common.py,sha256=L1qBBBS6jRgkXlGy5o6Xafo49auLXKRWyX9x8U_IKjc,482
|
|
|
37
37
|
uiautodev/utils/envutils.py,sha256=Clyt2Hz9PXpK_fT0yWbMmixXyGvCaJO3LAgamM7aUVc,197
|
|
38
38
|
uiautodev/utils/exceptions.py,sha256=lL_G_E41KWvfXnl32-E4Vgr3_HyTboxq_EwzdQMuvK4,637
|
|
39
39
|
uiautodev/utils/usbmux.py,sha256=LYupLDn7U4KFKhYQJrmIroS-3040gqZQVDRDB_FNDJM,17386
|
|
40
|
-
uiautodev-0.13.
|
|
41
|
-
uiautodev-0.13.
|
|
42
|
-
uiautodev-0.13.
|
|
43
|
-
uiautodev-0.13.
|
|
44
|
-
uiautodev-0.13.
|
|
40
|
+
uiautodev-0.13.1.dist-info/METADATA,sha256=pYogWWN2aGL3YmZjetrFVNnJ5YAe3zZNZusB4hFY8Bk,2973
|
|
41
|
+
uiautodev-0.13.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
42
|
+
uiautodev-0.13.1.dist-info/entry_points.txt,sha256=zBY8GgseYAAzPFA5Cf4rCCS9ivdyWsNxMVVYIaGAHJU,88
|
|
43
|
+
uiautodev-0.13.1.dist-info/licenses/LICENSE,sha256=RyeW676gBYO7AVVP2zQgfEx5rPSt46vR47xXZe7TlX4,1068
|
|
44
|
+
uiautodev-0.13.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|