找回密码
 加入
搜索
查看: 2169|回复: 7

[AU3基础] 有对手机ADB命令比较了解的么!

[复制链接]
发表于 2020-2-13 22:15:05 | 显示全部楼层 |阅读模式
adb exec-out /system/bin/uiautomator dump /dev/tty
这个应该会回显,在其他手机都正常,但是在OPPO手机显示
UI hierchary dumped to: /dev/tty
这尼玛是个什么情况,在shell里面输出,回显又是正常的!

 楼主| 发表于 2020-2-13 22:18:11 | 显示全部楼层
adb shell /system/bin/uiautomator dump /dev/pts/0会回显到已打开的SHELL里面,也不懂是个什么原理!
 楼主| 发表于 2020-2-13 22:31:46 | 显示全部楼层
adb shell uiautomator dump && adb pull /sdcard/window_dump.xml && start window_dump.xml
比较麻烦的办法就是这个了!还要把转储文件传到windows,再打开感觉蛮麻烦的!
 楼主| 发表于 2020-2-13 23:14:26 | 显示全部楼层
本帖最后由 heavenm 于 2020-2-13 23:16 编辑
_androidConsole('adb exec-out /system/bin/uiautomator dump /dev/tty')

Func _androidConsole($__command, $__drives = Null, $__timeout = 9)
        Local $__beginTime = TimerInit()
        Local $__binary = True
        Local $__consolePid, $__consoleStdout
        ConsoleWrite(StringFormat('%s ][ %s  \n', '_androidConsole', $__command))
        
        If $__drives <> Null Then;如果指定了设备,则加上-s参数
                $__drives = StringFormat('-s %s ', $__commandName, $__drives)
                $__command = StringRegExpReplace($__command, '^(\w+) ', '\1' & $__drives)
        EndIf
        
;~         If StringRegExp($__command, 'screencap') Then $__binary = True;如果是图片文件,用二进制
;~         If StringRegExp($__command, 'uiautomator') Then $__binary = True ;二进制输出
        
        $__consolePid = Run(@ComSpec & " /c " & $__command, @ScriptDir, @SW_HIDE, 8)
        Do
                Sleep(300)
                If TimerDiff($__beginTime) > $__timeout * 1000 Then Exit;命令超时退出
        Until Not ProcessExists($__consolePid)
;~         ProcessWaitClose($__consolePid, $__timeout)
;~         If @error Then MsgBox(0, '', '超时!!!')
        
        $__consoleStdout = StdoutRead($__consolePid, False, $__binary)
        If Not StringRegExp($__command, 'screencap') Then $__consoleStdout = BinaryToString($__consoleStdout, 4)
;~         If StringRegExp($__consoleStdout, 'unknown') Then Return -1;华为或者android9 dumpsys window policy  会输出unknown
        ConsoleWrite(StringFormat('%s ][ %s ][ %s  \n', '_androidConsole', TimerDiff($__beginTime), $__command))
        Return $__consoleStdout
EndFunc   ;==>_androidConsole
发表于 2020-2-14 09:29:23 | 显示全部楼层
坐等楼主放出答案
发表于 2020-2-14 12:30:19 | 显示全部楼层
不太懂 是要看APP的布局么 android studio 自带的 monitor 可以看。
 楼主| 发表于 2020-2-14 20:57:05 | 显示全部楼层
haijie1223 发表于 2020-2-14 09:29
坐等楼主放出答案

= =#无情,,,,,
 楼主| 发表于 2020-2-14 20:58:33 | 显示全部楼层
zch11230 发表于 2020-2-14 12:30
不太懂 是要看APP的布局么 android studio 自带的 monitor 可以看。

就是uiautomator 这个东西查看的!
android studio 就是这个东西
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-29 04:09 , Processed in 0.072491 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表