![](/img/trans.png)
[英]A new session could not be created. (Original error: Command failed: …\adb.exe -s 192.168.150.105:5555 shell “ps 'uiautomator'”" ps: uiautomator )
[英]Uiautomator bounds to coordinates using adb
我目前有一個問題,我正在使用UIautomator提取xml文件,我嘗試通過寫入的文本找到一個按鈕,然后嘗試使用adb刺激點擊。 但是我無法正確地將邊界轉換為x和y坐標。 這是我用來獲取xml文件的代碼。
adb shell uiautomator dump && adb pull /sdcard/window_dump.xml $TMPDIR
這是我用來轉換界限以協調框中文本的代碼:Signaler。
coords=$(perl -ne 'printf "%d %d\n", ($1)/2, ($3)/2 if /text="Signaler"[^>]*bounds="\[(\d+),(\d+)\]\[(\d+),(\d+)\]"/' $TMPDIR/window_dump.xml)
請問我在做什么錯?
您應該使用UIAutomator工具來獲取視圖的XY坐標。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.