Ran*_*cho 16 appium android-uiautomator
我必须自动化Android应用程序,我通过Appium做同样的事情.我面临的问题是在启动Appium服务器后,应用程序将安装在模拟器4.4.2中,并检查我正在使用UIAutomatorviewer的元素,它默认使用SDK.但在检查应用程序的元素时,我收到错误![在此处输入图像描述] [1]
Error obtaining UI hierarchy
Reason:Error while obtaining UI hierarchy XML file.com.android.ddmlb.SynchException.Remote object doesn't exist.
Run Code Online (Sandbox Code Playgroud)
我试图找到解决方案,以便我可以检查元素,以便我可以编写脚本,但是徒劳无功.
Ran*_*cho 29
在我与uiautomator查看器的约会后,我才知道我们只在以下情况下才会收到错误:
appium服务器正在运行,我们尝试使用uiautomatorviewer捕获屏幕截图.
因此,每当您想使用uiautomatorviewer时,请确保服务器处于停止状态.
小智 11
我使用以下方法修复了同样的问题.
(1)将您的Android设备连接到您的开发机器;
(2)转到终端的命令行或Windows的DOS命令行;
(3)在您的Android设备中使用"adb shell";
(4)在命令行输入"su root",将用户改为root;
(5)通过输入"chmod 777/data/local/tmp"将访问权限更改为/ data/local/tmp;
(6)回到uiautomatorviewer并再次进行屏幕截图,错误应该消失;
我猜有些文件无法访问,如果它不在/ data/local/tmp中.
小智 8
确保屏幕上的所有内容都是静态的.并且不允许闪烁输入光标.任何绘画操作都会阻止uiautomator转储当前的UI.
您可以使用以下adb命令进行测试:
adb shell uiautomator dump /data/local/tmp/uidump.xml
Run Code Online (Sandbox Code Playgroud)
如果ERROR: could not get idle state.出现该消息,则表示您遇到此问题.
见第87和101行DumpCommand:
Run Code Online (Sandbox Code Playgroud)try { ... uiAutomation.waitForIdle(1000, 1000 * 10); ... } catch (TimeoutException re) { System.err.println("ERROR: could not get idle state."); return; }
| 归档时间: |
|
| 查看次数: |
41447 次 |
| 最近记录: |