Re: [robotium-developers] How to click on tabs

804 views
Skip to first unread message

Yahor Paulavets

unread,
Nov 5, 2012, 8:32:09 AM11/5/12
to robotium-...@googlegroups.com
Hello,

You can click it by XY coord! :)
- Or by text
- Or by index
- Or by type
- Or by tag, if View contains some tag to simplify automation

Best regards,
Yahor

On Sun, Nov 4, 2012 at 12:35 PM, roei azar <roei...@gmail.com> wrote:
How can i click on tabs in my app. i mean how can i click on object without an ID?

Thanks

--
You received this message because you are subscribed to the Google Groups "Robotium Developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/robotium-developers/-/CvgCunzRf4wJ.
To post to this group, send email to robotium-...@googlegroups.com.
To unsubscribe from this group, send email to robotium-develo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/robotium-developers?hl=en.

OneBuild

unread,
Nov 6, 2012, 6:32:32 AM11/6/12
to robotium-...@googlegroups.com
hi,all,
I had other question about tabs. There are 3 tabs in a screen top, how can i verify which tab selected?
 
thanks, 
 

Date: Mon, 5 Nov 2012 16:32:09 +0300
Subject: Re: [robotium-developers] How to click on tabs
From: ypaul...@agilefusion.com
To: robotium-...@googlegroups.com

Yahor Paulavets

unread,
Nov 6, 2012, 4:37:09 PM11/6/12
to robotium-...@googlegroups.com
Hello,

I think you can check isSelected/getVisibility()/etc fields (use hierarchyviewer to verify this field).

Just get the view and check appropriate field.

Alternative way is to verify some view, which is for sure must be displayed on your tab.

Best regards,
Yahor

siddu kuligod

unread,
Feb 15, 2014, 5:35:08 AM2/15/14
to robotium-...@googlegroups.com
Hi, Thanks a lot. It worked perfectly..!!
On Wednesday, 7 November 2012 15:31:44 UTC+5:30, Paul Harris wrote:
I answered this the other day on stackoverflow, go to here to see the answer: http://stackoverflow.com/questions/13207068/androidrobotium-tab-click-with-only-icon/13231410#13231410

or here it is slighly less readable:

Tabhosts are evil. Luckily i also have had to automate them and so know the answer.

what you do is you have to get the tab bar view (android.R.id.tabs) and then cast it to a Tabhost or a ViewGroup then you can get each of the tabs via .getChildAt(x) where x is the index of the tabs.

ViewGroup tabs = (ViewGroup) solo.getView(android.R.id.tabs);
View viewYouWantToDoStuffWith = tabs.getChildAt(x); //change x to the index you want.

In your case you would then want something like:

solo.clickOnView(viewYouWantToDoStuffWith);
Yahor

To unsubscribe from this group, send email to robotium-developers+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/robotium-developers?hl=en.

--
You received this message because you are subscribed to the Google Groups "Robotium Developers" group.
To post to this group, send email to robotium-...@googlegroups.com.
To unsubscribe from this group, send email to robotium-developers+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/robotium-developers?hl=en.

--
You received this message because you are subscribed to the Google Groups "Robotium Developers" group.
To post to this group, send email to robotium-...@googlegroups.com.
To unsubscribe from this group, send email to robotium-developers+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages