【Appium】元素探测工具UIautomatorViewer 和Appium destop内置工具

    科技2022-08-14  108

    Appium destop内置元素探测工具

    platformName—设备平台:填Android或IOS

    deviceName----设备名:按adb devices查出的设备名填写即可,Android可以随便填写一个即可。 appPackage----要启动的app的包名:微信是"com.tencent.mm" 包名的获取方式,在安装好的android sdk 目录下有build-tools目录,有aapt工具,cmd切换到该路径下,可输入命令进行获取要测试的app包名 方法1

    aapt dump badging C:\Users\Yangzi\Downloads\aweme_aweGW_v130001_2665_1601189452.apk

    方法2

    adb shell dumpsys window windows | grep -E 'mCurrentFocus'

    appActivity----要启动的界面:微信启动界面是".ui.LauncherUI"

    获取方法1:在有待测apk的前提下

    aapt dump badging xx.apk

    获取方法2:在模拟器提前打开好待测apk

    adb shell dumpsys window windows | findstr mFocusedApp adb shell dumpsys window windows | grep -E 'mFocusedApp'

    获取方法3: 使用命令adb logcat|findstr START 手机成功连接电脑,确认adb devices成功,使用命令 adb logcat|findstr START.打开对应的APP,如图标红为对应app的包名和启动activity 同理adb shell logcat|grep ActivityManager 找到START后的cmp =包名/.当前活动的activity

    adb logcat | findstr START adb shell logcat|grep ActivityManager I/ActivityManager( 785): START u0 {act=android.intent.action.MAIN cat=[android. intent.category.LAUNCHER] flg=0x10200000 cmp=com.xxx.ordersystem/.activity.We lcomeActivity(包名和界面名) bnds=[540,960][798,1248]} from uid 10015 on display 0 from pid 177 4

    获取方法4

    adb shell dumpsys activity activities | findstr "mFocusedActivity" adb shell dumpsys activity activities | grep "mFocusedActivity" { "platformName": "android", "deviceName": "ruancexiaosheng", "automationName": "uiautomator2", "appPackage": "com.xueqiu.android", "appActivity": ".view.WelcomeActivityAlias" }

    元素探测工具UIautomatorViewer

    该工具的位置是在安卓sdk-tools-bin下 E:\andriod_sdk\tools\bin下

    注意该工具依赖于JDK,但JDK15不适用,建议使用JDK1.8版本

    Processed: 0.010, SQL: 9