使用uiautomatorviewer做UI测试

uiautomatorviewer.bat在android/sdk/tools/bin目录下,双击运行。


点击1号按钮,报错:

adb not installed' error when trying to take a snapshot with uiautomatorviewer

解决办法:
附上stackoverflow上的地址: https://plus.google.com/108487870030743970488/posts/2TrMqs1ZGQv,具体内容我粘贴过来:

My first experience with the new uiautomatorviewer:
"unable to connect to the adb. check if adb is installed correctly"

Challenge Accepted:
1. ScreenshotAction class has this in its run() method when !DebugBridge.isInitialized()

2. DebugBridge is not initialized when it can't find the "platform-tools" folder which it gets via the property ""com.android.uiautomator.bindir"

3. The above property is set (in windows) in uiautomatorviewer.bat:
call %java_exe% Djava.ext.dirs=%javaextdirs% -Dcom.android.uiautomator.bindir= -jar %jarpath% %

4. Strange that it is empty isn't it. Changing the above line in my case to:
call %java_exe% -Djava.ext.dirs=%javaextdirs% -Dcom.android.uiautomator.bindir=H:\android-sdk\tools -jar %jarpath% %

This solves the issue, and UI Automator Viewer is up. The app is pretty neat with all the "mouse over" "find view" feature.

我自己修改后的uiautomatorviewer.bat的内容:
call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=C:\Users\zhanglei_sx\AppData\Local\Android\Sdk\tools" -jar %jarpath% %*

以为解决了,继续点击按钮,又报错了。

Getting permission denied error while taking device screenshot from my android device by using UIAUTOMATOR

在stackoverflow上找到解决办法,运行adb root uiautomatorviewer。好了,终于有结果了。




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值