Skip to content

Commit 1ceb0e9

Browse files
authored
Merge pull request #7 from SMAT-Lab/uiviewer
Uiviewer: 截图和组件树的可视化关联
2 parents 6f26d32 + 13ddc62 commit 1ceb0e9

File tree

21 files changed

+4074
-247
lines changed

21 files changed

+4074
-247
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ haptest --policy perf_start_hap -i ALL --exclude com.huawei.* com.ohos.* -o out
7878
haptest -i com.example.demo --policy static_guided --staticConfig config.json --llm --simk 3 -o out
7979
```
8080

81+
### 6. Inspect UI hierarchy with the web viewer
82+
1. Ensure your HarmonyOS device or emulator is reachable through `hdc`.
83+
2. Start the UI viewer service (all arguments are optional unless you need to force a specific target):
84+
```
85+
haptest ui-viewer
86+
```
87+
- `--target`: optional connect key when multiple devices are attached; the service auto-detects when omitted.
88+
- `-p`: HTTP port for the local Express server (default `7789`).
89+
- `-o`: output directory for session artifacts.
90+
3. Browse to `http://localhost:7789/ui-viewer`.
91+
4. Click **Connect Device** to let the backend auto-detect the connected device. Once connected, click **Fetch Current Page** to capture the latest screenshot and hierarchy for the active foreground app.
92+
5. Explore the hierarchy tree, inspect widget metadata, or copy XPath snippets as needed. Use **Fetch Current Page** again any time you want to refresh the view.
93+
6. Press `Ctrl+C` in the terminal to stop the service when finished.
94+
8195
## Contribution
8296

8397
1. Fork the repository

0 commit comments

Comments
 (0)