简体   繁体   中英

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. Thanks. http://i.stack.imgur.com/d6vdH.png

You can check the url below for testing apk files

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! 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.

solo.clickOnText("your text to be clicked");

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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