简体   繁体   English

Robotium如何在LinearLayout中单击UILabel

[英]Robotium how to click on UILabel in LinearLayout

i'm new to android automation ,here is my problem : i am testing Apk file,i don't have resource code.i want to click UILabel in the LinearLayout ,AS is shown in the following chart。 Please help me out. 我是Android自动化的新手,这是我的问题:我正在测试Apk文件,我没有资源代码。我想在LinearLayout中单击UILabel,AS如下图所示。请帮帮我。 Thanks. 谢谢。 http://i.stack.imgur.com/d6vdH.png http://i.stack.imgur.com/d6vdH.png

You can check the url below for testing apk files 您可以查看下面的url来测试apk文件

https://code.google.com/p/robotium/wiki/RobotiumForAPKFiles https://code.google.com/p/robotium/wiki/RobotiumForAPKFiles

well as you said you haven't got source code which means you don't know which Id the UI element is! 正如你所说,你没有源代码,这意味着你不知道UI元素是哪个Id! so you can directly access ui labels from text and if you are unsure that ui element is visible then you can use solo.waitForText to wait till it is visible. 所以你可以直接从文本中访问ui标签,如果你不确定ui元素是否可见,那么你可以使用solo.waitForText等到它可见。

solo.clickOnText("your text to be clicked"); solo.clickOnText(“你要点击的文字”);

What about: 关于什么:

solo.clickOnView(solo.getView(TextLayout.class, 1));

or 要么

solo.clickOnView(((LinearLayout)solo.getView("toolLayout")).getChildAt(1));

I'm not sure about index (1 or 2) 我不确定索引(1或2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM