我们可以用UIAutomator Android应用程序? [英] can we use UIAutomator in android applications?

查看:611
本文介绍了我们可以用UIAutomator Android应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我们可以在应用程序中使用UIAutomator?
我想编写一个打开其他应用程序的应用程序,写在该应用程序的EditText一些文本,然后$​​ P $ PSS一些按钮(如开​​放视频群聊,写上文字,并发送邮件)。
u能推荐我,我该怎么办呢?

I want to know can we use UIAutomator in our applications ? I want write an app that open another application , Write some Text in that application EditText and then press some buttons(like open hangout and write a text on it and send the message ). Can u Suggest me how can i do this ?

我有搜索网,我只能找出我可以测试自己的UI与UIAutomator,但我不知道我可以用它来写一个Android应用程序(而不是jar文件)和我的Andr​​oid设备上运行它做到这一点。

i have search the net and i could only find out i can test my UI with UIAutomator , but i don't know can i use it to write a android application ( not jar file ) and run it on my android device to do this.

推荐答案

这是不可能的。

UiAutomator 2.0依赖于仪表这是唯一可用时运行使用上午仪器测试... 。常规(非测试)的应用程序不必仪表访问。

UiAutomator 2.0 relies on Instrumentation which is only available when you run your test using am instrument .... Regular (non-test) apps don't have access to Instrumentation.

根据壳牌UiAutomator是相似的。您可以执行使用亚行外壳测试uiautomator的runTest ... 和UiAutomatorTestRunner采取的事实,即它正在运行的shell用户做的事情,正常的应用程序没有权限做的。

Shell-based UiAutomator is similar. You execute tests using adb shell uiautomator runtest ... and UiAutomatorTestRunner takes advantage of the fact that it is running as the shell user to do things that normal apps don't have permission to do.

如果您使用运行#EXEC(..)来调用两个上午仪表 uiautomator的runTest ,该命令将不会作为shell用户身份运行(它将使用你的应用程序UID),​​因为它不具备必要的权限,将失败。

If you use Runtime#exec(..) to call either am instrument or uiautomator runtest, the command won't run as the shell user (it will use your application's uid), and will fail because it doesn't have the necessary permissions.

这篇关于我们可以用UIAutomator Android应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆