2013-05-28

How to scroll/ nevigate in Robotium?

In this article we are going to see how to scroll on the screen in robotium. Basically, this is nevigation over items.

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

-To scroll down to screen.
solo.scrollDown();
It returns false if not possible(end of screen)

-To scroll down to specific list (AbsListView). In here mylist is a AbsListView item
solo.scrollDownList(myList);
It returns false if not possible(end of screen)

-To scroll down to specific index(zero based) in a ListView
solo.scrollDownList(0);
It returns false if not possible(end of screen)

-To scroll to bottom of the screen
solo.scrollToBottom();      

-To scroll to bottom of the list (AbsListView). In here mylist is a AbsListView item
solo.scrollListToBottom(myList);
It returns false if not possible(end of screen)

-To scroll to bottom to specific ListView index(zero based)
solo.scrollListToBottom(1);      
It returns false if not possible(end of screen)

-To scroll a specified AbsListView and Line (integer)
solo.scrollListToLine(myList, 1);

-To scroll a AbsListView item with specific index and specified line. Both integer
solo.scrollListToLine(1,1);      

-To scroll Horizontally. We can provide two values as parameter, solo.RIGHT or solo.LEFT
solo.scrollToSide(solo.RIGHT);

-To scroll Horizontally to a specific AbsListView item.
solo.scrollViewToSide(myView, solo.LEFT);

Note : We can provide two values as parameter, solo.RIGHT or solo.LEFT

-To scroll to top of the screen
solo.scrollToTop();
      
-To scroll Up. It returns false if not possible(top of screen)
solo.scrollUp();

-To scroll Up to specific AbsListView item
solo.scrollUpList(myList);

-To scroll Up a list view to specific Index(Zero Based)
solo.scrollUpList(1);

-To scroll the list to the top in a specific AbsListView item.
solo.scrollListToTop(myList);
It returns false if not possible(top of screen)

-To scroll the list to the top in a list view index(Zero Based)
solo.scrollListToTop(0);
It returns false if not possible(top of screen)

...Thanks...:)

No comments:

Post a Comment