3

我正在研究在没有任何工作站连接的情况下在设备上运行 android 自动化的方法。

我的方法是这样的,我修改了猴子的源代码,并且能够启动 3rd 方应用程序(我没有源代码访问权限),我也可以将击键发送到应用程序。但现在我面临另一个问题,我需要访问一些 ui 元素的属性,例如获取按钮的文本以进行验证。

如何从我的应用程序中获取系统(或顶级活动)的层次结构?

4

3 回答 3

2

There is a way, check out Robotium here: http://code.google.com/p/robotium/ It is open source, so you should be able to check out how they do it.

You don't need access to sources of the target app.

于 2012-07-18T13:57:58.900 回答
2

不,没有办法做到这一点。

于 2012-04-24T13:49:04.330 回答
1

我将从查看层次结构开始:

https://madcoda.com/2013/01/inspect-the-view-hierarchy-of-any-android-app/ https://developer.android.com/studio/profile/ddms.html

然后使用 Accessibility 类编写代码来访问它。 http://www.apps4android.org/?p=3628

于 2016-11-08T01:39:08.167 回答