Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

robotium - clicking on action bar tabs

I'm finishing up moving to the actionbar (using actionbarsherlock), and one of the last things is to convert all the robotium integration tests. Clicking on action bar action items seems to be solved, however I cannot figure out how to click on action bar tabs with Robotium.

like image 812
yincrash Avatar asked Sep 25 '12 21:09

yincrash


2 Answers

Action Bar Screen

you can use

[1] solo.clickOnText("TAB A"); 
    // click on action bar tab 1
    // where action bar tab 1 diaplay text = "TAB A"

[2] solo.clickOnText("TAB A"); 
    // click on action bar tab 1
    // where action bar tab 1 diaplay text = "TAB A"

if you have images in action bar tabs,

enter image description here

[1] solo.clickOnImage(0); OR solo.clickOnImageButton(0);
        // click on action bar tab 1

[2] solo.clickOnImage(1); OR solo.clickOnImageButton(1); 
        // click on action bar tab 2

i hope this will help you. Thanks.

like image 60
VISHAL VIRADIA Avatar answered Oct 13 '22 21:10

VISHAL VIRADIA


Click on action bar :-If you have the source code of the application under test, The best way is when you identify the Action Bar Item by its Id, which can be found in the R.Java of the application under test.

solo.clickOnActionBarItem(R.id.ItemToBEClicked);

like image 42
alok923 Avatar answered Oct 13 '22 22:10

alok923