In this article we are going to see how to click different type of items using Robotium.

We need to initiate the Solo object. After initiation, we will uses solo to get those.

For List items:
- To click a specific list line and returns an Array List of TextView objects. .

solo.clickInList(0);
Parameter is the Line Number to click. Will use the first ListView of it finds.


- To click a specific list line and returns an Array List of TextView objects. .
solo.clickInList(1,0);
Parameter is the Line Number and the List Index to click.

For Buttons : 
-To  click Home Button
solo.clickOnActionBarHomeButton();

-To click the Action Bar Item with specific id( as integer )
solo.clickOnActionBarItem(1);


-To click Button that matches the Id( as integer )
solo.clickOnButton(1);

-To click Button that matches the text
 solo.clickOnButton("Delete");
It will use scrolling automatically

-To click on an image Button with specific index(zero based Integer)
solo.clickOnImageButton(0);

-To click a toggle Button that matches the text
solo.clickOnToggleButton("Enable");

-To click on an Radio Button with specific index(zero based Integer)
solo.clickOnRadioButton(0);

-To click Check Box that matches the Id( as integer )
solo.clickOnCheckBox(0);


For View or Web Element : 
-To click a View /WebElement item that showing a specific text. It will automatically scroll if needed.
solo.clickOnText("ClickHere");


-To click a View /WebElement item that showing a specific text and matching index.
solo.clickOnText("Regix", 0);

-To click a View /WebElement item that showing a specific text, matching and scrolling mode
solo.clickOnText("Regix", 0, true);

Note : 
-The text parameter is handled as Regix matching
-Matching Index will define which one to click on multiple objects found.
-Scrolling true means, it will scroll.

-To click a specific view 
solo.clickOnView(myView);

-To click a specific view without wait(immediately)
solo.clickOnView(myView, true);

-To click a web element with a specified object(using By)
solo.clickOnWebElement(By.id("Id"));

-To click a web element with a specified object(using By) and matching index.
solo.clickOnWebElement(By.id("Id"), 0);

-To click a web element with a specified object(using By) ,matching index and scrolling selection(true/false). If true, scrolling will be performed
solo.clickOnWebElement(By.id("Id"), 0, true);

-To click a specific web element
solo.clickOnWebElement(myWebElement);

There are some other items which can be present for click event. Some are clicked in following ways.

-To click on current EditText item with specific index(zero based Integer)

solo.clickOnEditText(0);

-To click on an image view item with specific index.(zero based Integer)
solo.clickOnImage(0);

-To click on screen position with X coordinate and Y coordinate .
solo.clickOnScreen(240,400);
X an Y coordinate calculated from top upper corner of screen. For example if you have a cell phone of 480x800 resolution. When it is in portrait mode, x value max 480, Y value max 800.

Thanks..:)