|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.robotium.solo.Solo
public class Solo
Main class for development of Robotium tests.
Robotium has full support for Views, WebViews, Activities, Dialogs, Menus and Context Menus.
Robotium can be used in conjunction with Android test classes like
ActivityInstrumentationTestCase2 and SingleLaunchActivityTestCase.
| Nested Class Summary | |
|---|---|
static class |
Solo.Config
Config class used to set the scroll behaviour, default timeouts, screenshot filetype and screenshot save path. |
| Field Summary | |
|---|---|
protected com.robotium.solo.ActivityUtils |
activityUtils
|
protected com.robotium.solo.Asserter |
asserter
|
protected com.robotium.solo.Checker |
checker
|
protected com.robotium.solo.Clicker |
clicker
|
static int |
CLOSED
|
static int |
DELETE
|
protected com.robotium.solo.DialogUtils |
dialogUtils
|
static int |
DOWN
|
static int |
ENTER
|
protected com.robotium.solo.Getter |
getter
|
protected com.robotium.solo.Illustrator |
illustrator
|
protected android.app.Instrumentation |
instrumentation
|
static int |
LANDSCAPE
|
static int |
LEFT
|
static int |
MENU
|
static int |
OPENED
|
static int |
PORTRAIT
|
protected com.robotium.solo.Presser |
presser
|
static int |
RIGHT
|
protected com.robotium.solo.Rotator |
rotator
|
protected com.robotium.solo.ScreenshotTaker |
screenshotTaker
|
protected com.robotium.solo.Scroller |
scroller
|
protected com.robotium.solo.Searcher |
searcher
|
protected com.robotium.solo.Sender |
sender
|
protected com.robotium.solo.Setter |
setter
|
protected com.robotium.solo.Sleeper |
sleeper
|
protected com.robotium.solo.Swiper |
swiper
|
protected SystemUtils |
systemUtils
|
protected com.robotium.solo.Tapper |
tapper
|
protected com.robotium.solo.TextEnterer |
textEnterer
|
static int |
UP
|
protected com.robotium.solo.ViewFetcher |
viewFetcher
|
protected com.robotium.solo.Waiter |
waiter
|
protected String |
webUrl
|
protected com.robotium.solo.WebUtils |
webUtils
|
protected com.robotium.solo.Zoomer |
zoomer
|
| Constructor Summary | |
|---|---|
Solo(android.app.Instrumentation instrumentation)
Constructor that takes the instrumentation object. |
|
Solo(android.app.Instrumentation instrumentation,
android.app.Activity activity)
Constructor that takes the Instrumentation object and the start Activity. |
|
Solo(android.app.Instrumentation instrumentation,
Solo.Config config)
Constructor that takes the Instrumentation and Config objects. |
|
Solo(android.app.Instrumentation instrumentation,
Solo.Config config,
android.app.Activity activity)
Constructor that takes the Instrumentation, Config and Activity objects. |
|
| Method Summary | ||
|---|---|---|
void |
assertCurrentActivity(String message,
Class activityClass)
Asserts that the Activity matching the specified class is active. |
|
void |
assertCurrentActivity(String message,
Class activityClass,
boolean isNewInstance)
Asserts that the Activity matching the specified class is active, with the possibility to verify that the expected Activity is a new instance of the Activity. |
|
void |
assertCurrentActivity(String message,
String name)
Asserts that the Activity matching the specified name is active. |
|
void |
assertCurrentActivity(String message,
String name,
boolean isNewInstance)
Asserts that the Activity matching the specified name is active, with the possibility to verify that the expected Activity is a new instance of the Activity. |
|
void |
assertMemoryNotLow()
Asserts that the available memory is not considered low by the system. |
|
void |
clearEditText(android.widget.EditText editText)
Clears the value of an EditText. |
|
void |
clearEditText(int index)
Clears the value of an EditText. |
|
void |
clearLog()
Clears the log. |
|
void |
clearTextInWebElement(By by)
Clears text in a WebElement matching the specified By object. |
|
ArrayList<android.widget.TextView> |
clickInList(int line)
Clicks the specified list line and returns an ArrayList of the TextView objects that the list line is displaying. |
|
ArrayList<android.widget.TextView> |
clickInList(int line,
int index)
Clicks the specified list line in the ListView matching the specified index and returns an ArrayList of the TextView objects that the list line is displaying. |
|
ArrayList<android.widget.TextView> |
clickInRecyclerView(int itemIndex)
Clicks the specified item index and returns an ArrayList of the TextView objects that the item index is displaying. |
|
ArrayList<android.widget.TextView> |
clickInRecyclerView(int itemIndex,
int recyclerViewIndex)
Clicks the specified item index in the RecyclerView matching the specified RecyclerView index and returns an ArrayList of the TextView objects that the list line is displaying. |
|
ArrayList<android.widget.TextView> |
clickLongInList(int line)
Long clicks the specified list line and returns an ArrayList of the TextView objects that the list line is displaying. |
|
ArrayList<android.widget.TextView> |
clickLongInList(int line,
int index)
Long clicks the specified list line in the ListView matching the specified index and returns an ArrayList of the TextView objects that the list line is displaying. |
|
ArrayList<android.widget.TextView> |
clickLongInList(int line,
int index,
int time)
Long clicks the specified list line in the ListView matching the specified index and returns an ArrayList of the TextView objects that the list line is displaying. |
|
ArrayList<android.widget.TextView> |
clickLongInRecycleView(int itemIndex)
Long clicks the specified item index and returns an ArrayList of the TextView objects that the item index is displaying. |
|
ArrayList<android.widget.TextView> |
clickLongInRecycleView(int itemIndex,
int recyclerViewIndex)
Long clicks the specified item index in the RecyclerView matching the specified RecyclerView index and returns an ArrayList of the TextView objects that the item index is displaying. |
|
ArrayList<android.widget.TextView> |
clickLongInRecycleView(int itemIndex,
int recyclerViewIndex,
int time)
Long clicks the specified item index in the RecyclerView matching the specified RecyclerView index and returns an ArrayList of the TextView objects that the item index is displaying. |
|
void |
clickLongOnScreen(float x,
float y)
Long clicks the specified coordinates. |
|
void |
clickLongOnScreen(float x,
float y,
int time)
Long clicks the specified coordinates for a specified amount of time. |
|
void |
clickLongOnText(String text)
Long clicks a View or WebElement displaying the specified text. |
|
void |
clickLongOnText(String text,
int match)
Long clicks a View or WebElement displaying the specified text. |
|
void |
clickLongOnText(String text,
int match,
boolean scroll)
Long clicks a View or WebElement displaying the specified text. |
|
void |
clickLongOnText(String text,
int match,
int time)
Long clicks a View or WebElement displaying the specified text. |
|
void |
clickLongOnTextAndPress(String text,
int index)
Long clicks a View displaying the specified text and then selects an item from the context menu that appears. |
|
void |
clickLongOnView(android.view.View view)
Long clicks the specified View. |
|
void |
clickLongOnView(android.view.View view,
int time)
Long clicks the specified View for a specified amount of time. |
|
void |
clickOnActionBarHomeButton()
Clicks an ActionBar Home/Up button. |
|
void |
clickOnActionBarItem(int id)
Clicks an ActionBarItem matching the specified resource id. |
|
void |
clickOnButton(int index)
Clicks a Button matching the specified index. |
|
void |
clickOnButton(String text)
Clicks a Button displaying the specified text. |
|
void |
clickOnCheckBox(int index)
Clicks a CheckBox matching the specified index. |
|
void |
clickOnEditText(int index)
Clicks an EditText matching the specified index. |
|
void |
clickOnImage(int index)
Clicks an ImageView matching the specified index. |
|
void |
clickOnImageButton(int index)
Clicks an ImageButton matching the specified index. |
|
void |
clickOnMenuItem(String text)
Clicks a MenuItem displaying the specified text. |
|
void |
clickOnMenuItem(String text,
boolean subMenu)
Clicks a MenuItem displaying the specified text. |
|
void |
clickOnRadioButton(int index)
Clicks a RadioButton matching the specified index. |
|
void |
clickOnScreen(float x,
float y)
Clicks the specified coordinates. |
|
void |
clickOnScreen(float x,
float y,
int numberOfClicks)
Clicks the specified coordinates rapidly a specified number of times. |
|
void |
clickOnText(String text)
Clicks a View or WebElement displaying the specified text. |
|
void |
clickOnText(String text,
int match)
Clicks a View or WebElement displaying the specified text. |
|
void |
clickOnText(String text,
int match,
boolean scroll)
Clicks a View or WebElement displaying the specified text. |
|
void |
clickOnToggleButton(String text)
Clicks a ToggleButton displaying the specified text. |
|
void |
clickOnView(android.view.View view)
Clicks the specified View. |
|
void |
clickOnView(android.view.View view,
boolean immediately)
Clicks the specified View. |
|
void |
clickOnWebElement(By by)
Clicks a WebElement matching the specified By object. |
|
void |
clickOnWebElement(By by,
int match)
Clicks a WebElement matching the specified By object. |
|
void |
clickOnWebElement(By by,
int match,
boolean scroll)
Clicks a WebElement matching the specified By object. |
|
void |
clickOnWebElement(WebElement webElement)
Clicks the specified WebElement. |
|
Illustration.Builder |
createIllustrationBuilder()
An Builder pattern that will allow the client to build a new illustration |
|
void |
drag(float fromX,
float toX,
float fromY,
float toY,
int stepCount)
Simulate touching the specified location and dragging it to a new location. |
|
void |
enterText(android.widget.EditText editText,
String text)
Enters text in the specified EditText. |
|
void |
enterText(int index,
String text)
Enters text in an EditText matching the specified index. |
|
void |
enterTextInWebElement(By by,
String text)
Enters text in a WebElement matching the specified By object. |
|
void |
finalize()
Finalizes the Solo object and removes the ActivityMonitor. |
|
void |
finishOpenedActivities()
The Activities that are alive are finished. |
|
android.app.Instrumentation.ActivityMonitor |
getActivityMonitor()
Returns the ActivityMonitor used by Robotium. |
|
android.widget.Button |
getButton(int index)
Returns a Button matching the specified index. |
|
android.widget.Button |
getButton(String text)
Returns a Button displaying the specified text. |
|
android.widget.Button |
getButton(String text,
boolean onlyVisible)
Returns a Button displaying the specified text. |
|
Solo.Config |
getConfig()
Returns the Config used by Robotium. |
|
android.app.Activity |
getCurrentActivity()
Returns the current Activity. |
|
ArrayList<android.view.View> |
getCurrentViews()
Returns an ArrayList of the Views currently displayed in the focused Activity or Dialog. |
|
|
getCurrentViews(Class<T> classToFilterBy)
Returns an ArrayList of Views matching the specified class located in the focused Activity or Dialog. |
|
|
getCurrentViews(Class<T> classToFilterBy,
boolean includeSubclasses)
Returns an ArrayList of Views matching the specified class located in the focused Activity or Dialog. |
|
|
getCurrentViews(Class<T> classToFilterBy,
boolean includeSubclasses,
android.view.View parent)
Returns an ArrayList of Views matching the specified class located under the specified parent. |
|
|
getCurrentViews(Class<T> classToFilterBy,
android.view.View parent)
Returns an ArrayList of Views matching the specified class located under the specified parent. |
|
ArrayList<WebElement> |
getCurrentWebElements()
Returns an ArrayList of the currently displayed WebElements in the active WebView. |
|
ArrayList<WebElement> |
getCurrentWebElements(By by)
Returns an ArrayList of the currently displayed WebElements in the active WebView matching the specified By object. |
|
android.widget.EditText |
getEditText(int index)
Returns an EditText matching the specified index. |
|
android.widget.EditText |
getEditText(String text)
Returns an EditText displaying the specified text. |
|
android.widget.EditText |
getEditText(String text,
boolean onlyVisible)
Returns an EditText displaying the specified text. |
|
android.widget.ImageView |
getImage(int index)
Returns an ImageView matching the specified index. |
|
android.widget.ImageButton |
getImageButton(int index)
Returns an ImageButton matching the specified index. |
|
String |
getString(int id)
Returns a localized String matching the specified resource id. |
|
String |
getString(String id)
Returns a localized String matching the specified resource id. |
|
android.widget.TextView |
getText(int index)
Returns a TextView matching the specified index. |
|
android.widget.TextView |
getText(String text)
Returns a TextView displaying the specified text. |
|
android.widget.TextView |
getText(String text,
boolean onlyVisible)
Returns a TextView displaying the specified text. |
|
android.view.View |
getTopParent(android.view.View view)
Returns the absolute top parent View of the specified View. |
|
|
getView(Class<T> viewClass,
int index)
Returns a View matching the specified class and index. |
|
android.view.View |
getView(int id)
Returns a View matching the specified resource id. |
|
android.view.View |
getView(int id,
int index)
Returns a View matching the specified resource id and index. |
|
android.view.View |
getView(Object tag)
Returns a View matching the specified tag. |
|
android.view.View |
getView(Object tag,
int index)
Returns a View matching the specified tag and index. |
|
android.view.View |
getView(String id)
Returns a View matching the specified resource id. |
|
android.view.View |
getView(String id,
int index)
Returns a View matching the specified resource id and index. |
|
ArrayList<android.view.View> |
getViews()
Returns an ArrayList of all the View objects located in the focused Activity or Dialog. |
|
ArrayList<android.view.View> |
getViews(android.view.View parent)
Returns an ArrayList of the View objects contained in the parent View. |
|
WebElement |
getWebElement(By by,
int index)
Returns a WebElement matching the specified By object and index. |
|
ArrayList<WebElement> |
getWebElements()
Returns an ArrayList of all the WebElements displayed in the active WebView. |
|
ArrayList<WebElement> |
getWebElements(By by)
Returns an ArrayList of all the WebElements displayed in the active WebView matching the specified By object. |
|
String |
getWebUrl()
Returns the current web page URL. |
|
void |
goBack()
Simulates pressing the hardware back key. |
|
void |
goBackToActivity(String name)
Returns to an Activity matching the specified name. |
|
void |
hideSoftKeyboard()
Hides the soft keyboard. |
|
void |
illustrate(Illustration illustration)
Simulate drawing an illustration on the screen. |
|
boolean |
isCheckBoxChecked(int index)
Checks if a CheckBox matching the specified index is checked. |
|
boolean |
isCheckBoxChecked(String text)
Checks if a CheckBox displaying the specified text is checked. |
|
boolean |
isRadioButtonChecked(int index)
Checks if a RadioButton matching the specified index is checked. |
|
boolean |
isRadioButtonChecked(String text)
Checks if a RadioButton displaying the specified text is checked. |
|
boolean |
isSpinnerTextSelected(int index,
String text)
Checks if the specified text is selected in a Spinner matching the specified index. |
|
boolean |
isSpinnerTextSelected(String text)
Checks if the specified text is selected in any Spinner located in the current screen. |
|
boolean |
isTextChecked(String text)
Checks if the specified text is checked. |
|
boolean |
isToggleButtonChecked(int index)
Checks if a ToggleButton matching the specified index is checked. |
|
boolean |
isToggleButtonChecked(String text)
Checks if a ToggleButton displaying the specified text is checked. |
|
void |
pinchToZoom(android.graphics.PointF startPoint1,
android.graphics.PointF startPoint2,
android.graphics.PointF endPoint1,
android.graphics.PointF endPoint2)
Zooms in or out if startPoint1 and startPoint2 are larger or smaller then endPoint1 and endPoint2. |
|
void |
pressMenuItem(int index)
Presses a MenuItem matching the specified index. |
|
void |
pressMenuItem(int index,
int itemsPerRow)
Presses a MenuItem matching the specified index. |
|
void |
pressSoftKeyboardDoneButton()
Presses the soft keyboard done button. |
|
void |
pressSoftKeyboardGoButton()
Presses the soft keyboard go button. |
|
void |
pressSoftKeyboardNextButton()
Presses the soft keyboard next button. |
|
void |
pressSoftKeyboardSearchButton()
Presses the soft keyboard search button. |
|
void |
pressSpinnerItem(int spinnerIndex,
int itemIndex)
Presses a Spinner (drop-down menu) item. |
|
void |
rotateLarge(android.graphics.PointF center1,
android.graphics.PointF center2)
Draws two semi-circles at the specified centers. |
|
void |
rotateSmall(android.graphics.PointF center1,
android.graphics.PointF center2)
Draws two semi-circles at the specified centers. |
|
boolean |
scrollDown()
Scrolls down the screen. |
|
boolean |
scrollDownList(android.widget.AbsListView list)
Scrolls down the specified AbsListView. |
|
boolean |
scrollDownList(int index)
Scrolls down a ListView matching the specified index. |
|
boolean |
scrollDownRecyclerView(int index)
Scrolls down a RecyclerView matching the specified index. |
|
boolean |
scrollListToBottom(android.widget.AbsListView list)
Scrolls to the bottom of the specified AbsListView. |
|
boolean |
scrollListToBottom(int index)
Scrolls a ListView matching the specified index to the bottom. |
|
void |
scrollListToLine(android.widget.AbsListView absListView,
int line)
Scroll the specified AbsListView to the specified line. |
|
void |
scrollListToLine(int index,
int line)
Scroll a AbsListView matching the specified index to the specified line. |
|
boolean |
scrollListToTop(android.widget.AbsListView list)
Scrolls to the top of the specified AbsListView. |
|
boolean |
scrollListToTop(int index)
Scrolls a ListView matching the specified index to the top. |
|
boolean |
scrollRecyclerViewToBottom(int index)
Scrolls a RecyclerView matching the specified index to the bottom. |
|
boolean |
scrollRecyclerViewToTop(int index)
Scrolls a RecyclerView matching the specified index to the top. |
|
void |
scrollToBottom()
Scrolls to the bottom of the screen. |
|
void |
scrollToSide(int side)
Scrolls horizontally. |
|
void |
scrollToSide(int side,
float scrollPosition)
Scrolls horizontally. |
|
void |
scrollToSide(int side,
float scrollPosition,
int stepCount)
Scrolls horizontally. |
|
void |
scrollToTop()
Scrolls to the top of the screen. |
|
boolean |
scrollUp()
Scrolls up the screen. |
|
boolean |
scrollUpList(android.widget.AbsListView list)
Scrolls up the specified AbsListView. |
|
boolean |
scrollUpList(int index)
Scrolls up a ListView matching the specified index. |
|
boolean |
scrollUpRecyclerView(int index)
Scrolls up a RecyclerView matching the specified index. |
|
void |
scrollViewToSide(android.view.View view,
int side)
Scrolls a View horizontally. |
|
void |
scrollViewToSide(android.view.View view,
int side,
float scrollPosition)
Scrolls a View horizontally. |
|
void |
scrollViewToSide(android.view.View view,
int side,
float scrollPosition,
int stepCount)
Scrolls a View horizontally. |
|
boolean |
searchButton(String text)
Searches for a Button displaying the specified text and returns true if at least one Button
is found. |
|
boolean |
searchButton(String text,
boolean onlyVisible)
Searches for a Button displaying the specified text and returns true if at least one Button
is found. |
|
boolean |
searchButton(String text,
int minimumNumberOfMatches)
Searches for a Button displaying the specified text and returns true if the
searched Button is found a specified number of times. |
|
boolean |
searchButton(String text,
int minimumNumberOfMatches,
boolean onlyVisible)
Searches for a Button displaying the specified text and returns true if the
searched Button is found a specified number of times. |
|
boolean |
searchEditText(String text)
Searches for a text in the EditText objects currently displayed and returns true if found. |
|
boolean |
searchText(String text)
Searches for the specified text and returns true if at least one item
is found displaying the expected text. |
|
boolean |
searchText(String text,
boolean onlyVisible)
Searches for the specified text and returns true if at least one item
is found displaying the expected text. |
|
boolean |
searchText(String text,
int minimumNumberOfMatches)
Searches for the specified text and returns true if the searched text is found a specified
number of times. |
|
boolean |
searchText(String text,
int minimumNumberOfMatches,
boolean scroll)
Searches for the specified text and returns true if the searched text is found a specified
number of times. |
|
boolean |
searchText(String text,
int minimumNumberOfMatches,
boolean scroll,
boolean onlyVisible)
Searches for the specified text and returns true if the searched text is found a specified
number of times. |
|
boolean |
searchToggleButton(String text)
Searches for a ToggleButton displaying the specified text and returns true if at least one ToggleButton
is found. |
|
boolean |
searchToggleButton(String text,
int minimumNumberOfMatches)
Searches for a ToggleButton displaying the specified text and returns true if the
searched ToggleButton is found a specified number of times. |
|
void |
sendKey(int key)
Sends a key: Right, Left, Up, Down, Enter, Menu or Delete. |
|
void |
setActivityOrientation(int orientation)
Sets the Orientation (Landscape/Portrait) for the current Activity. |
|
void |
setDatePicker(android.widget.DatePicker datePicker,
int year,
int monthOfYear,
int dayOfMonth)
Sets the date in the specified DatePicker. |
|
void |
setDatePicker(int index,
int year,
int monthOfYear,
int dayOfMonth)
Sets the date in a DatePicker matching the specified index. |
|
void |
setMobileData(Boolean turnedOn)
Sets if mobile data should be turned on or off. |
|
void |
setNavigationDrawer(int status)
Sets the status of the NavigationDrawer. |
|
void |
setProgressBar(int index,
int progress)
Sets the progress of a ProgressBar matching the specified index. |
|
void |
setProgressBar(android.widget.ProgressBar progressBar,
int progress)
Sets the progress of the specified ProgressBar. |
|
void |
setSlidingDrawer(int index,
int status)
Sets the status of a SlidingDrawer matching the specified index. |
|
void |
setSlidingDrawer(android.widget.SlidingDrawer slidingDrawer,
int status)
Sets the status of the specified SlidingDrawer. |
|
void |
setTimePicker(int index,
int hour,
int minute)
Sets the time in a TimePicker matching the specified index. |
|
void |
setTimePicker(android.widget.TimePicker timePicker,
int hour,
int minute)
Sets the time in the specified TimePicker. |
|
void |
setWiFiData(Boolean turnedOn)
Sets if wifi data should be turned on or off. |
|
void |
sleep(int time)
Robotium will sleep for the specified time. |
|
void |
startScreenshotSequence(String name)
Takes a screenshot sequence and saves the images with the specified name prefix in the Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/). |
|
void |
startScreenshotSequence(String name,
int quality,
int frameDelay,
int maxFrames)
Takes a screenshot sequence and saves the images with the specified name prefix in the Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/). |
|
void |
stopScreenshotSequence()
Causes a screenshot sequence to end. |
|
void |
swipe(android.graphics.PointF startPoint1,
android.graphics.PointF startPoint2,
android.graphics.PointF endPoint1,
android.graphics.PointF endPoint2)
Swipes with two fingers in a linear path determined by starting and ending points. |
|
void |
takeScreenshot()
Takes a screenshot and saves it in the Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/). |
|
void |
takeScreenshot(String name)
Takes a screenshot and saves it with the specified name in the Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/). |
|
void |
takeScreenshot(String name,
int quality)
Takes a screenshot and saves the image with the specified name in the Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/). |
|
void |
typeText(android.widget.EditText editText,
String text)
Types text in the specified EditText. |
|
void |
typeText(int index,
String text)
Types text in an EditText matching the specified index. |
|
void |
typeTextInWebElement(By by,
String text)
Types text in a WebElement matching the specified By object. |
|
void |
typeTextInWebElement(By by,
String text,
int match)
Types text in a WebElement matching the specified By object. |
|
void |
typeTextInWebElement(WebElement webElement,
String text)
Types text in the specified WebElement. |
|
void |
unlockScreen()
Unlocks the lock screen. |
|
boolean |
waitForActivity(Class<? extends android.app.Activity> activityClass)
Waits for an Activity matching the specified class. |
|
boolean |
waitForActivity(Class<? extends android.app.Activity> activityClass,
int timeout)
Waits for an Activity matching the specified class. |
|
boolean |
waitForActivity(String name)
Waits for an Activity matching the specified name. |
|
boolean |
waitForActivity(String name,
int timeout)
Waits for an Activity matching the specified name. |
|
boolean |
waitForCondition(Condition condition,
int timeout)
Waits for a condition to be satisfied. |
|
boolean |
waitForDialogToClose()
Waits for a Dialog to close. |
|
boolean |
waitForDialogToClose(long timeout)
Waits for a Dialog to close. |
|
boolean |
waitForDialogToOpen()
Waits for a Dialog to open. |
|
boolean |
waitForDialogToOpen(long timeout)
Waits for a Dialog to open. |
|
boolean |
waitForEmptyActivityStack(int timeout)
Wait for the activity stack to be empty. |
|
boolean |
waitForFragmentById(int id)
Waits for a Fragment matching the specified resource id. |
|
boolean |
waitForFragmentById(int id,
int timeout)
Waits for a Fragment matching the specified resource id. |
|
boolean |
waitForFragmentByTag(String tag)
Waits for a Fragment matching the specified tag. |
|
boolean |
waitForFragmentByTag(String tag,
int timeout)
Waits for a Fragment matching the specified tag. |
|
boolean |
waitForLogMessage(String logMessage)
Waits for the specified log message to appear. |
|
boolean |
waitForLogMessage(String logMessage,
int timeout)
Waits for the specified log message to appear. |
|
boolean |
waitForText(String text)
Waits for the specified text to appear. |
|
boolean |
waitForText(String text,
int minimumNumberOfMatches,
long timeout)
Waits for the specified text to appear. |
|
boolean |
waitForText(String text,
int minimumNumberOfMatches,
long timeout,
boolean scroll)
Waits for the specified text to appear. |
|
boolean |
waitForText(String text,
int minimumNumberOfMatches,
long timeout,
boolean scroll,
boolean onlyVisible)
Waits for the specified text to appear. |
|
|
waitForView(Class<T> viewClass)
Waits for a View matching the specified class. |
|
|
waitForView(Class<T> viewClass,
int minimumNumberOfMatches,
int timeout)
Waits for a View matching the specified class. |
|
|
waitForView(Class<T> viewClass,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
Waits for a View matching the specified class. |
|
boolean |
waitForView(int id)
Waits for a View matching the specified resource id. |
|
boolean |
waitForView(int id,
int minimumNumberOfMatches,
int timeout)
Waits for a View matching the specified resource id. |
|
boolean |
waitForView(int id,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
Waits for a View matching the specified resource id. |
|
boolean |
waitForView(Object tag)
Waits for a View matching the specified tag. |
|
boolean |
waitForView(Object tag,
int minimumNumberOfMatches,
int timeout)
Waits for a View matching the specified tag. |
|
boolean |
waitForView(Object tag,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
Waits for a View matching the specified tag |
|
|
waitForView(android.view.View view)
Waits for the specified View. |
|
|
waitForView(android.view.View view,
int timeout,
boolean scroll)
Waits for the specified View. |
|
boolean |
waitForWebElement(By by)
Waits for a WebElement matching the specified By object. |
|
boolean |
waitForWebElement(By by,
int timeout,
boolean scroll)
Waits for a WebElement matching the specified By object. |
|
boolean |
waitForWebElement(By by,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
Waits for a WebElement matching the specified By object. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final com.robotium.solo.Asserter asserter
protected final com.robotium.solo.ViewFetcher viewFetcher
protected final com.robotium.solo.Checker checker
protected final com.robotium.solo.Clicker clicker
protected final com.robotium.solo.Presser presser
protected final com.robotium.solo.Searcher searcher
protected final com.robotium.solo.ActivityUtils activityUtils
protected final com.robotium.solo.DialogUtils dialogUtils
protected final com.robotium.solo.TextEnterer textEnterer
protected final com.robotium.solo.Rotator rotator
protected final com.robotium.solo.Scroller scroller
protected final com.robotium.solo.Sleeper sleeper
protected final com.robotium.solo.Swiper swiper
protected final com.robotium.solo.Tapper tapper
protected final com.robotium.solo.Illustrator illustrator
protected final com.robotium.solo.Waiter waiter
protected final com.robotium.solo.Setter setter
protected final com.robotium.solo.Getter getter
protected final com.robotium.solo.WebUtils webUtils
protected final com.robotium.solo.Sender sender
protected final com.robotium.solo.ScreenshotTaker screenshotTaker
protected final android.app.Instrumentation instrumentation
protected final com.robotium.solo.Zoomer zoomer
protected final SystemUtils systemUtils
protected String webUrl
public static final int LANDSCAPE
public static final int PORTRAIT
public static final int RIGHT
public static final int LEFT
public static final int UP
public static final int DOWN
public static final int ENTER
public static final int MENU
public static final int DELETE
public static final int CLOSED
public static final int OPENED
| Constructor Detail |
|---|
public Solo(android.app.Instrumentation instrumentation,
android.app.Activity activity)
instrumentation - the Instrumentation instanceactivity - the start Activity or null
if no Activity is specified
public Solo(android.app.Instrumentation instrumentation,
Solo.Config config)
instrumentation - the Instrumentation instanceconfig - the Solo.Config instance
public Solo(android.app.Instrumentation instrumentation,
Solo.Config config,
android.app.Activity activity)
instrumentation - the Instrumentation instanceconfig - the Solo.Config instanceactivity - the start Activity or null
if no Activity is specifiedpublic Solo(android.app.Instrumentation instrumentation)
instrumentation - the Instrumentation instance| Method Detail |
|---|
public android.app.Instrumentation.ActivityMonitor getActivityMonitor()
public Solo.Config getConfig()
public ArrayList<android.view.View> getViews()
ArrayList of the View objects located in the focused windowpublic ArrayList<android.view.View> getViews(android.view.View parent)
parent - the parent view from which to return the views
ArrayList of the View objects contained in the specified Viewpublic android.view.View getTopParent(android.view.View view)
view - the View whose top parent is requested
Viewpublic boolean waitForText(String text)
text - the text to wait for, specified as a regular expression
true if text is displayed and false if it is not displayed before the timeout
public boolean waitForText(String text,
int minimumNumberOfMatches,
long timeout)
text - the text to wait for, specified as a regular expressionminimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the the amount of time in milliseconds to wait
true if text is displayed and false if it is not displayed before the timeout
public boolean waitForText(String text,
int minimumNumberOfMatches,
long timeout,
boolean scroll)
text - the text to wait for, specified as a regular expressionminimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the the amount of time in milliseconds to waitscroll - true if scrolling should be performed
true if text is displayed and false if it is not displayed before the timeout
public boolean waitForText(String text,
int minimumNumberOfMatches,
long timeout,
boolean scroll,
boolean onlyVisible)
text - the text to wait for, specified as a regular expressionminimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the the amount of time in milliseconds to waitscroll - true if scrolling should be performedonlyVisible - true if only visible text views should be waited for
true if text is displayed and false if it is not displayed before the timeoutpublic boolean waitForView(int id)
id - the R.id of the View to wait for
true if the View is displayed and false if it is not displayed before the timeout
public boolean waitForView(int id,
int minimumNumberOfMatches,
int timeout)
id - the R.id of the View to wait forminimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the amount of time in milliseconds to wait
true if the View is displayed and false if it is not displayed before the timeout
public boolean waitForView(int id,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
id - the R.id of the View to wait forminimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the amount of time in milliseconds to waitscroll - true if scrolling should be performed
true if the View is displayed and false if it is not displayed before the timeoutpublic boolean waitForView(Object tag)
tag - the tag of the View to wait for
true if the View is displayed and false if it is not displayed before the timeout
public boolean waitForView(Object tag,
int minimumNumberOfMatches,
int timeout)
tag - the tag of the View to wait forminimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the amount of time in milliseconds to wait
true if the View is displayed and false if it is not displayed before the timeout
public boolean waitForView(Object tag,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
tag - the tag of the View to wait forminimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the amount of time in milliseconds to waitscroll - true if scrolling should be performed
true if the View is displayed and false if it is not displayed before the timeoutpublic <T extends android.view.View> boolean waitForView(Class<T> viewClass)
viewClass - the View class to wait for
true if the View is displayed and false if it is not displayed before the timeoutpublic <T extends android.view.View> boolean waitForView(android.view.View view)
view - the View object to wait for
true if the View is displayed and false if it is not displayed before the timeout
public <T extends android.view.View> boolean waitForView(android.view.View view,
int timeout,
boolean scroll)
view - the View object to wait fortimeout - the amount of time in milliseconds to waitscroll - true if scrolling should be performed
true if the View is displayed and false if it is not displayed before the timeout
public <T extends android.view.View> boolean waitForView(Class<T> viewClass,
int minimumNumberOfMatches,
int timeout)
viewClass - the View class to wait forminimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the amount of time in milliseconds to wait
true if the View is displayed and false if it is not displayed before the timeout
public <T extends android.view.View> boolean waitForView(Class<T> viewClass,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
viewClass - the View class to wait forminimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the amount of time in milliseconds to waitscroll - true if scrolling should be performed
true if the View is displayed and false if it is not displayed before the timeoutpublic boolean waitForWebElement(By by)
by - the By object. Examples are: By.id("id") and By.name("name")
true if the WebElement is displayed and false if it is not displayed before the timeout
public boolean waitForWebElement(By by,
int timeout,
boolean scroll)
by - the By object. Examples are: By.id("id") and By.name("name")timeout - the the amount of time in milliseconds to waitscroll - true if scrolling should be performed
true if the WebElement is displayed and false if it is not displayed before the timeout
public boolean waitForWebElement(By by,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
by - the By object. Examples are: By.id("id") and By.name("name")minimumNumberOfMatches - the minimum number of matches that are expected to be found. 0 means any number of matchestimeout - the the amount of time in milliseconds to waitscroll - true if scrolling should be performed
true if the WebElement is displayed and false if it is not displayed before the timeout
public boolean waitForCondition(Condition condition,
int timeout)
condition - the condition to wait fortimeout - the amount of time in milliseconds to wait
true if condition is satisfied and false if it is not satisfied before the timeoutpublic boolean searchEditText(String text)
text - the text to search for
true if an EditText displaying the specified text is found or false if it is not foundpublic boolean searchButton(String text)
true if at least one Button
is found. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expression
true if a Button displaying the specified text is found and false if it is not found
public boolean searchButton(String text,
boolean onlyVisible)
true if at least one Button
is found. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressiononlyVisible - true if only Button visible on the screen should be searched
true if a Button displaying the specified text is found and false if it is not foundpublic boolean searchToggleButton(String text)
true if at least one ToggleButton
is found. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expression
true if a ToggleButton displaying the specified text is found and false if it is not found
public boolean searchButton(String text,
int minimumNumberOfMatches)
true if the
searched Button is found a specified number of times. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressionminimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be found
true if a Button displaying the specified text is found a specified number of times and false
if it is not found
public boolean searchButton(String text,
int minimumNumberOfMatches,
boolean onlyVisible)
true if the
searched Button is found a specified number of times. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressionminimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be foundonlyVisible - true if only Button visible on the screen should be searched
true if a Button displaying the specified text is found a specified number of times and false
if it is not found
public boolean searchToggleButton(String text,
int minimumNumberOfMatches)
true if the
searched ToggleButton is found a specified number of times. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressionminimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be found
true if a ToggleButton displaying the specified text is found a specified number of times and false
if it is not foundpublic boolean searchText(String text)
true if at least one item
is found displaying the expected text. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expression
true if the search string is found and false if it is not found
public boolean searchText(String text,
boolean onlyVisible)
true if at least one item
is found displaying the expected text. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressiononlyVisible - true if only texts visible on the screen should be searched
true if the search string is found and false if it is not found
public boolean searchText(String text,
int minimumNumberOfMatches)
true if the searched text is found a specified
number of times. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressionminimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be found
true if text is found a specified number of times and false if the text
is not found
public boolean searchText(String text,
int minimumNumberOfMatches,
boolean scroll)
true if the searched text is found a specified
number of times.
text - the text to search for. The parameter will be interpreted as a regular expression.minimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be foundscroll - true if scrolling should be performed
true if text is found a specified number of times and false if the text
is not found
public boolean searchText(String text,
int minimumNumberOfMatches,
boolean scroll,
boolean onlyVisible)
true if the searched text is found a specified
number of times.
text - the text to search for. The parameter will be interpreted as a regular expression.minimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be foundscroll - true if scrolling should be performedonlyVisible - true if only texts visible on the screen should be searched
true if text is found a specified number of times and false if the text
is not foundpublic void setActivityOrientation(int orientation)
orientation - the orientation to set. Solo.LANDSCAPE for landscape or
Solo.PORTRAIT for portrait.public android.app.Activity getCurrentActivity()
public void assertCurrentActivity(String message,
String name)
message - the message to display if the assert failsname - the name of the Activity that is expected to be active. Example is: "MyActivity"
public void assertCurrentActivity(String message,
Class activityClass)
message - the message to display if the assert failsactivityClass - the class of the Activity that is expected to be active. Example is: MyActivity.class
public void assertCurrentActivity(String message,
String name,
boolean isNewInstance)
message - the message to display if the assert failsname - the name of the Activity that is expected to be active. Example is: "MyActivity"isNewInstance - true if the expected Activity is a new instance of the Activity
public void assertCurrentActivity(String message,
Class activityClass,
boolean isNewInstance)
message - the message to display if the assert failsactivityClass - the class of the Activity that is expected to be active. Example is: MyActivity.classisNewInstance - true if the expected Activity is a new instance of the Activitypublic void assertMemoryNotLow()
public boolean waitForDialogToOpen()
true if the Dialog is opened before the timeout and false if it is not openedpublic boolean waitForDialogToClose()
true if the Dialog is closed before the timeout and false if it is not closedpublic boolean waitForDialogToOpen(long timeout)
timeout - the amount of time in milliseconds to wait
true if the Dialog is opened before the timeout and false if it is not openedpublic boolean waitForDialogToClose(long timeout)
timeout - the amount of time in milliseconds to wait
true if the Dialog is closed before the timeout and false if it is not closedpublic void goBack()
public void clickOnScreen(float x,
float y)
x - the x coordinatey - the y coordinate
public void clickOnScreen(float x,
float y,
int numberOfClicks)
x - the x coordinatey - the y coordinatenumberOfClicks - the number of clicks to perform
public void clickLongOnScreen(float x,
float y)
x - the x coordinatey - the y coordinate
public void clickLongOnScreen(float x,
float y,
int time)
x - the x coordinatey - the y coordinatetime - the amount of time to long clickpublic void clickOnButton(String text)
text - the text displayed by the Button. The parameter will be interpreted as a regular expressionpublic void clickOnImageButton(int index)
index - the index of the ImageButton to click. 0 if only one is availablepublic void clickOnToggleButton(String text)
text - the text displayed by the ToggleButton. The parameter will be interpreted as a regular expressionpublic void clickOnMenuItem(String text)
text - the text displayed by the MenuItem. The parameter will be interpreted as a regular expression
public void clickOnMenuItem(String text,
boolean subMenu)
text - the text displayed by the MenuItem. The parameter will be interpreted as a regular expressionsubMenu - true if the menu item could be located in a sub menupublic void clickOnWebElement(WebElement webElement)
webElement - the WebElement to clickpublic void clickOnWebElement(By by)
by - the By object. Examples are: By.id("id") and By.name("name")
public void clickOnWebElement(By by,
int match)
by - the By object. Examples are: By.id("id") and By.name("name")match - if multiple objects match, this determines which one to click
public void clickOnWebElement(By by,
int match,
boolean scroll)
by - the By object. Examples are: By.id("id") and By.name("name")match - if multiple objects match, this determines which one to clickscroll - true if scrolling should be performedpublic void pressMenuItem(int index)
0 is the first item in the
first row, Index 3 is the first item in the second row and
index 6 is the first item in the third row.
index - the index of the MenuItem to press
public void pressMenuItem(int index,
int itemsPerRow)
index - the index of the MenuItem to pressitemsPerRow - the amount of menu items there are per rowpublic void pressSoftKeyboardNextButton()
public void pressSoftKeyboardSearchButton()
public void pressSoftKeyboardGoButton()
public void pressSoftKeyboardDoneButton()
public void pressSpinnerItem(int spinnerIndex,
int itemIndex)
spinnerIndex - the index of the Spinner menu to useitemIndex - the index of the Spinner item to press relative to the currently selected item.
A Negative number moves up on the Spinner, positive moves downpublic void clickOnView(android.view.View view)
view - the View to click
public void clickOnView(android.view.View view,
boolean immediately)
view - the View to clickimmediately - true if View should be clicked without any waitpublic void clickLongOnView(android.view.View view)
view - the View to long click
public void clickLongOnView(android.view.View view,
int time)
view - the View to long clicktime - the amount of time to long clickpublic void clickOnText(String text)
text - the text to click. The parameter will be interpreted as a regular expression
public void clickOnText(String text,
int match)
text - the text to click. The parameter will be interpreted as a regular expressionmatch - if multiple objects match the text, this determines which one to click
public void clickOnText(String text,
int match,
boolean scroll)
text - the text to click. The parameter will be interpreted as a regular expressionmatch - if multiple objects match the text, this determines which one to clickscroll - true if scrolling should be performedpublic void clickLongOnText(String text)
text - the text to click. The parameter will be interpreted as a regular expression
public void clickLongOnText(String text,
int match)
text - the text to click. The parameter will be interpreted as a regular expressionmatch - if multiple objects match the text, this determines which one to click
public void clickLongOnText(String text,
int match,
boolean scroll)
text - the text to click. The parameter will be interpreted as a regular expressionmatch - if multiple objects match the text, this determines which one to clickscroll - true if scrolling should be performed
public void clickLongOnText(String text,
int match,
int time)
text - the text to click. The parameter will be interpreted as a regular expressionmatch - if multiple objects match the text, this determines which one to clicktime - the amount of time to long click
public void clickLongOnTextAndPress(String text,
int index)
text - the text to click. The parameter will be interpreted as a regular expressionindex - the index of the menu item to press. 0 if only one is availablepublic void clickOnButton(int index)
index - the index of the Button to click. 0 if only one is availablepublic void clickOnRadioButton(int index)
index - the index of the RadioButton to click. 0 if only one is availablepublic void clickOnCheckBox(int index)
index - the index of the CheckBox to click. 0 if only one is availablepublic void clickOnEditText(int index)
index - the index of the EditText to click. 0 if only one is availablepublic ArrayList<android.widget.TextView> clickInList(int line)
line - the line to click
ArrayList of the TextView objects located in the list line
public ArrayList<android.widget.TextView> clickInList(int line,
int index)
line - the line to clickindex - the index of the list. 0 if only one is available
ArrayList of the TextView objects located in the list linepublic ArrayList<android.widget.TextView> clickLongInList(int line)
line - the line to click
ArrayList of the TextView objects located in the list line
public ArrayList<android.widget.TextView> clickLongInList(int line,
int index)
line - the line to clickindex - the index of the list. 0 if only one is available
ArrayList of the TextView objects located in the list line
public ArrayList<android.widget.TextView> clickLongInList(int line,
int index,
int time)
line - the line to clickindex - the index of the list. 0 if only one is availabletime - the amount of time to long click
ArrayList of the TextView objects located in the list linepublic ArrayList<android.widget.TextView> clickInRecyclerView(int itemIndex)
itemIndex - the item index to click
ArrayList of the TextView objects located in the item index
public ArrayList<android.widget.TextView> clickInRecyclerView(int itemIndex,
int recyclerViewIndex)
itemIndex - the line to clickrecyclerViewIndex - the index of the RecyclerView. 0 if only one is available
ArrayList of the TextView objects located in the item indexpublic ArrayList<android.widget.TextView> clickLongInRecycleView(int itemIndex)
itemIndex - the item index to click
ArrayList of the TextView objects located in the list line
public ArrayList<android.widget.TextView> clickLongInRecycleView(int itemIndex,
int recyclerViewIndex)
itemIndex - the item index to clickrecyclerViewIndex - the index of the RecyclerView. 0 if only one is available
ArrayList of the TextView objects located in the list line
public ArrayList<android.widget.TextView> clickLongInRecycleView(int itemIndex,
int recyclerViewIndex,
int time)
itemIndex - the item index to clickrecyclerViewIndex - the index of the RecyclerView. 0 if only one is availabletime - the amount of time to long click
ArrayList of the TextView objects located in the list linepublic void clickOnActionBarItem(int id)
id - the R.id of the ActionBar item to clickpublic void clickOnActionBarHomeButton()
public Illustration.Builder createIllustrationBuilder()
public void illustrate(Illustration illustration)
Illustration.Builder builder = solo.createIllustrationBuilder();
builder.addPoint(200, 20000, MotionEvent.TOOL_TYPE_FINGER);
builder.addPoint(1000, 1500, MotionEvent.TOOL_TYPE_FINGER);
Illustration illustration = builder.build();
solo.illustrate(illustration);
illustration - Built-up illustration containing toolType, pressure, and coordinate information.
public void drag(float fromX,
float toX,
float fromY,
float toY,
int stepCount)
fromX - X coordinate of the initial touch, in screen coordinatestoX - X coordinate of the drag destination, in screen coordinatesfromY - Y coordinate of the initial touch, in screen coordinatestoY - Y coordinate of the drag destination, in screen coordinatesstepCount - how many move steps to include in the drag. Less steps results in a faster dragpublic boolean scrollDown()
true if more scrolling can be performed and false if it is at the end of
the screenpublic void scrollToBottom()
public boolean scrollUp()
true if more scrolling can be performed and false if it is at the top of
the screenpublic void scrollToTop()
public boolean scrollDownList(android.widget.AbsListView list)
list - the AbsListView to scroll
true if more scrolling can be performedpublic boolean scrollListToBottom(android.widget.AbsListView list)
list - the AbsListView to scroll
true if more scrolling can be performedpublic boolean scrollUpList(android.widget.AbsListView list)
list - the AbsListView to scroll
true if more scrolling can be performedpublic boolean scrollListToTop(android.widget.AbsListView list)
list - the AbsListView to scroll
true if more scrolling can be performedpublic boolean scrollDownList(int index)
index - the index of the ListView to scroll. 0 if only one list is available
true if more scrolling can be performedpublic boolean scrollListToBottom(int index)
index - the index of the ListView to scroll. 0 if only one list is available
true if more scrolling can be performedpublic boolean scrollUpList(int index)
index - the index of the ListView to scroll. 0 if only one list is available
true if more scrolling can be performedpublic boolean scrollListToTop(int index)
index - the index of the ListView to scroll. 0 if only one list is available
true if more scrolling can be performed
public void scrollListToLine(android.widget.AbsListView absListView,
int line)
absListView - the AbsListView to scrollline - the line to scroll to
public void scrollListToLine(int index,
int line)
index - the index of the AbsListView to scrollline - the line to scroll topublic boolean scrollDownRecyclerView(int index)
index - the index of the RecyclerView to scroll. 0 if only one RecyclerView is available
true if more scrolling can be performedpublic boolean scrollRecyclerViewToBottom(int index)
index - the index of the RecyclerView to scroll. 0 if only one list is available
true if more scrolling can be performedpublic boolean scrollUpRecyclerView(int index)
index - the index of the RecyclerView to scroll. 0 if only one list is available
true if more scrolling can be performedpublic boolean scrollRecyclerViewToTop(int index)
index - the index of the RecyclerView to scroll. 0 if only one list is available
true if more scrolling can be performed
public void scrollToSide(int side,
float scrollPosition,
int stepCount)
side - the side to scroll; RIGHT or LEFTscrollPosition - the position to scroll to, from 0 to 1 where 1 is all the way. Example is: 0.60stepCount - how many move steps to include in the scroll. Less steps results in a faster scroll
public void scrollToSide(int side,
float scrollPosition)
side - the side to scroll; RIGHT or LEFTscrollPosition - the position to scroll to, from 0 to 1 where 1 is all the way. Example is: 0.60public void scrollToSide(int side)
side - the side to scroll; RIGHT or LEFT
public void scrollViewToSide(android.view.View view,
int side,
float scrollPosition,
int stepCount)
view - the View to scrollside - the side to scroll; RIGHT or LEFTscrollPosition - the position to scroll to, from 0 to 1 where 1 is all the way. Example is: 0.60stepCount - how many move steps to include in the scroll. Less steps results in a faster scroll
public void scrollViewToSide(android.view.View view,
int side,
float scrollPosition)
view - the View to scrollside - the side to scroll; RIGHT or LEFTscrollPosition - the position to scroll to, from 0 to 1 where 1 is all the way. Example is: 0.60
public void scrollViewToSide(android.view.View view,
int side)
view - the View to scrollside - the side to scroll; RIGHT or LEFT
public void pinchToZoom(android.graphics.PointF startPoint1,
android.graphics.PointF startPoint2,
android.graphics.PointF endPoint1,
android.graphics.PointF endPoint2)
startPoint1 - First "finger" down on the screenstartPoint2 - Second "finger" down on the screenendPoint1 - Corresponding ending point of startPoint1endPoint2 - Corresponding ending point of startPoint2
public void swipe(android.graphics.PointF startPoint1,
android.graphics.PointF startPoint2,
android.graphics.PointF endPoint1,
android.graphics.PointF endPoint2)
startPoint1 - First "finger" down on the screenstartPoint2 - Second "finger" down on the screenendPoint1 - Corresponding ending point of startPoint1endPoint2 - Corresponding ending point of startPoint2
public void rotateLarge(android.graphics.PointF center1,
android.graphics.PointF center2)
center1 - Center of semi-circle drawn from [0, Pi]center2 - Center of semi-circle drawn from [Pi, 3*Pi]
public void rotateSmall(android.graphics.PointF center1,
android.graphics.PointF center2)
center1 - Center of semi-circle drawn from [0, Pi]center2 - Center of semi-circle drawn from [Pi, 3*Pi]public void setMobileData(Boolean turnedOn)
turnedOn - true if mobile data is to be turned on and false if notpublic void setWiFiData(Boolean turnedOn)
turnedOn - true if mobile wifi is to be turned on and false if not
public void setDatePicker(int index,
int year,
int monthOfYear,
int dayOfMonth)
index - the index of the DatePicker. 0 if only one is availableyear - the year e.g. 2011monthOfYear - the month which starts from zero e.g. 0 for JanuarydayOfMonth - the day e.g. 10
public void setDatePicker(android.widget.DatePicker datePicker,
int year,
int monthOfYear,
int dayOfMonth)
datePicker - the DatePicker objectyear - the year e.g. 2011monthOfYear - the month which starts from zero e.g. 03 for AprildayOfMonth - the day e.g. 10
public void setTimePicker(int index,
int hour,
int minute)
index - the index of the TimePicker. 0 if only one is availablehour - the hour e.g. 15minute - the minute e.g. 30
public void setTimePicker(android.widget.TimePicker timePicker,
int hour,
int minute)
timePicker - the TimePicker objecthour - the hour e.g. 15minute - the minute e.g. 30
public void setProgressBar(int index,
int progress)
SeekBar and RatingBar.
index - the index of the ProgressBarprogress - the progress to set the ProgressBar
public void setProgressBar(android.widget.ProgressBar progressBar,
int progress)
SeekBar and RatingBar.
progressBar - the ProgressBarprogress - the progress to set the ProgressBarpublic void setNavigationDrawer(int status)
Solo.CLOSED and Solo.OPENED.
status - the status that the NavigationDrawer should be set to
public void setSlidingDrawer(int index,
int status)
Solo.CLOSED and Solo.OPENED.
index - the index of the SlidingDrawerstatus - the status to set the SlidingDrawer
public void setSlidingDrawer(android.widget.SlidingDrawer slidingDrawer,
int status)
Solo.CLOSED and Solo.OPENED.
slidingDrawer - the SlidingDrawerstatus - the status to set the SlidingDrawer
public void enterText(int index,
String text)
index - the index of the EditText. 0 if only one is availabletext - the text to enter in the EditText field
public void enterText(android.widget.EditText editText,
String text)
editText - the EditText to enter text intext - the text to enter in the EditText field
public void enterTextInWebElement(By by,
String text)
by - the By object. Examples are: By.id("id") and By.name("name")text - the text to enter in the WebElement field
public void typeText(int index,
String text)
index - the index of the EditText. 0 if only one is availabletext - the text to type in the EditText field
public void typeText(android.widget.EditText editText,
String text)
editText - the EditText to type text intext - the text to type in the EditText field
public void typeTextInWebElement(By by,
String text)
by - the By object. Examples are: By.id("id") and By.name("name")text - the text to enter in the WebElement field
public void typeTextInWebElement(By by,
String text,
int match)
by - the By object. Examples are: By.id("id") and By.name("name")text - the text to enter in the WebElement fieldmatch - if multiple objects match, this determines which one will be typed in
public void typeTextInWebElement(WebElement webElement,
String text)
webElement - the WebElement to type text intext - the text to enter in the WebElement fieldpublic void clearEditText(int index)
index - the index of the EditText to clear. 0 if only one is availablepublic void clearEditText(android.widget.EditText editText)
editText - the EditText to clearpublic void clearTextInWebElement(By by)
by - the By object. Examples are: By.id("id") and By.name("name")public void clickOnImage(int index)
index - the index of the ImageView to click. 0 if only one is availablepublic android.widget.EditText getEditText(int index)
index - the index of the EditText. 0 if only one is available
EditText matching the specified indexpublic android.widget.Button getButton(int index)
index - the index of the Button. 0 if only one is available
Button matching the specified indexpublic android.widget.TextView getText(int index)
index - the index of the TextView. 0 if only one is available
TextView matching the specified indexpublic android.widget.ImageView getImage(int index)
index - the index of the ImageView. 0 if only one is available
ImageView matching the specified indexpublic android.widget.ImageButton getImageButton(int index)
index - the index of the ImageButton. 0 if only one is available
ImageButton matching the specified indexpublic android.widget.TextView getText(String text)
text - the text that is displayed, specified as a regular expression
TextView displaying the specified text
public android.widget.TextView getText(String text,
boolean onlyVisible)
text - the text that is displayed, specified as a regular expressiononlyVisible - true if only visible texts on the screen should be returned
TextView displaying the specified textpublic android.widget.Button getButton(String text)
text - the text that is displayed, specified as a regular expression
Button displaying the specified text
public android.widget.Button getButton(String text,
boolean onlyVisible)
text - the text that is displayed, specified as a regular expressiononlyVisible - true if only visible buttons on the screen should be returned
Button displaying the specified textpublic android.widget.EditText getEditText(String text)
text - the text that is displayed, specified as a regular expression
EditText displaying the specified text
public android.widget.EditText getEditText(String text,
boolean onlyVisible)
text - the text that is displayed, specified as a regular expressiononlyVisible - true if only visible EditTexts on the screen should be returned
EditText displaying the specified textpublic android.view.View getView(int id)
id - the R.id of the View to return
View matching the specified id
public android.view.View getView(int id,
int index)
id - the R.id of the View to returnindex - the index of the View. 0 if only one is available
View matching the specified id and indexpublic android.view.View getView(Object tag)
tag - the tag of the View to return
View matching the specified id
public android.view.View getView(Object tag,
int index)
tag - the tag of the View to returnindex - the index of the View. 0 if only one is available
View matching the specified id and indexpublic android.view.View getView(String id)
id - the id of the View to return
View matching the specified id
public android.view.View getView(String id,
int index)
id - the id of the View to returnindex - the index of the View. 0 if only one is available
View matching the specified id and index
public <T extends android.view.View> T getView(Class<T> viewClass,
int index)
viewClass - the class of the requested viewindex - the index of the View. 0 if only one is available
View matching the specified class and index
public WebElement getWebElement(By by,
int index)
by - the By object. Examples are: By.id("id") and By.name("name")index - the index of the WebElement. 0 if only one is available
WebElement matching the specified indexpublic String getWebUrl()
public ArrayList<android.view.View> getCurrentViews()
ArrayList of the View objects currently displayed in the
focused windowpublic <T extends android.view.View> ArrayList<T> getCurrentViews(Class<T> classToFilterBy)
classToFilterBy - return all instances of this class. Examples are: Button.class or ListView.class
ArrayList of Views matching the specified Class located in the current Activity
public <T extends android.view.View> ArrayList<T> getCurrentViews(Class<T> classToFilterBy,
boolean includeSubclasses)
classToFilterBy - return all instances of this class. Examples are: Button.class or ListView.classincludeSubclasses - include instances of the subclasses in the ArrayList that will be returned
ArrayList of Views matching the specified Class located in the current Activity
public <T extends android.view.View> ArrayList<T> getCurrentViews(Class<T> classToFilterBy,
android.view.View parent)
classToFilterBy - return all instances of this class. Examples are: Button.class or ListView.classparent - the parent View for where to start the traversal
ArrayList of Views matching the specified Class located under the specified parent
public <T extends android.view.View> ArrayList<T> getCurrentViews(Class<T> classToFilterBy,
boolean includeSubclasses,
android.view.View parent)
classToFilterBy - return all instances of this class. Examples are: Button.class or ListView.classincludeSubclasses - include instances of subclasses in the ArrayList that will be returnedparent - the parent View for where to start the traversal
ArrayList of Views matching the specified Class located under the specified parentpublic ArrayList<WebElement> getWebElements()
ArrayList of all the WebElement objects currently displayed in the active WebViewpublic ArrayList<WebElement> getWebElements(By by)
by - the By object. Examples are: By.id("id") and By.name("name")
ArrayList of all the WebElement objects displayed in the active WebViewpublic ArrayList<WebElement> getCurrentWebElements()
ArrayList of the WebElement objects displayed in the active WebViewpublic ArrayList<WebElement> getCurrentWebElements(By by)
by - the By object. Examples are: By.id("id") and By.name("name")
ArrayList of the WebElement objects currently displayed in the active WebViewpublic boolean isRadioButtonChecked(int index)
index - of the RadioButton to check. 0 if only one is available
true if RadioButton is checked and false if it is not checkedpublic boolean isRadioButtonChecked(String text)
text - the text that the RadioButton displays, specified as a regular expression
true if a RadioButton matching the specified text is checked and false if it is not checkedpublic boolean isCheckBoxChecked(int index)
index - of the CheckBox to check. 0 if only one is available
true if CheckBox is checked and false if it is not checkedpublic boolean isToggleButtonChecked(String text)
text - the text that the ToggleButton displays, specified as a regular expression
true if a ToggleButton matching the specified text is checked and false if it is not checkedpublic boolean isToggleButtonChecked(int index)
index - of the ToggleButton to check. 0 if only one is available
true if ToggleButton is checked and false if it is not checkedpublic boolean isCheckBoxChecked(String text)
text - the text that the CheckBox displays, specified as a regular expression
true if a CheckBox displaying the specified text is checked and false if it is not checkedpublic boolean isTextChecked(String text)
text - the text that the CheckedTextView or CompoundButton objects display, specified as a regular expression
true if the specified text is checked and false if it is not checkedpublic boolean isSpinnerTextSelected(String text)
text - the text that is expected to be selected, specified as a regular expression
true if the specified text is selected in any Spinner and false if it is not
public boolean isSpinnerTextSelected(int index,
String text)
index - the index of the spinner to check. 0 if only one spinner is availabletext - the text that is expected to be selected, specified as a regular expression
true if the specified text is selected in the specified Spinner and false if it is notpublic void hideSoftKeyboard()
public void unlockScreen()
public void sendKey(int key)
key - the key to be sent. Use Solo.RIGHT, LEFT, UP, DOWN,
ENTER, MENU, DELETEpublic void goBackToActivity(String name)
name - the name of the Activity to return to. Example is: "MyActivity"public boolean waitForActivity(String name)
name - the name of the Activity to wait for. Example is: "MyActivity"
true if Activity appears before the timeout and false if it does not
public boolean waitForActivity(String name,
int timeout)
name - the name of the Activity to wait for. Example is: "MyActivity"timeout - the amount of time in milliseconds to wait
true if Activity appears before the timeout and false if it does notpublic boolean waitForActivity(Class<? extends android.app.Activity> activityClass)
activityClass - the class of the Activity to wait for. Example is: MyActivity.class
true if Activity appears before the timeout and false if it does not
public boolean waitForActivity(Class<? extends android.app.Activity> activityClass,
int timeout)
activityClass - the class of the Activity to wait for. Example is: MyActivity.classtimeout - the amount of time in milliseconds to wait
true if Activity appears before the timeout and false if it does notpublic boolean waitForEmptyActivityStack(int timeout)
timeout - the amount of time in milliseconds to wait
true if activity stack is empty before the timeout and false if it is notpublic boolean waitForFragmentByTag(String tag)
tag - the name of the tag
true if fragment appears and false if it does not appear before the timeout
public boolean waitForFragmentByTag(String tag,
int timeout)
tag - the name of the tagtimeout - the amount of time in milliseconds to wait
true if fragment appears and false if it does not appear before the timeoutpublic boolean waitForFragmentById(int id)
id - the R.id of the fragment
true if fragment appears and false if it does not appear before the timeout
public boolean waitForFragmentById(int id,
int timeout)
id - the R.id of the fragmenttimeout - the amount of time in milliseconds to wait
true if fragment appears and false if it does not appear before the timeoutpublic boolean waitForLogMessage(String logMessage)
logMessage - the log message to wait for
true if log message appears and false if it does not appear before the timeoutclearLog()
public boolean waitForLogMessage(String logMessage,
int timeout)
logMessage - the log message to wait fortimeout - the amount of time in milliseconds to wait
true if log message appears and false if it does not appear before the timeoutclearLog()public void clearLog()
public String getString(int id)
id - the R.id of the String
public String getString(String id)
id - the id of the String
public void sleep(int time)
time - the time in milliseconds that Robotium should sleep
public void finalize()
throws Throwable
finalize in class ObjectThrowablefinishOpenedActivities() to close the activities that have been activepublic void finishOpenedActivities()
public void takeScreenshot()
Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/).
Requires write permission (android.permission.WRITE_EXTERNAL_STORAGE) in AndroidManifest.xml of the application under test.
public void takeScreenshot(String name)
Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/).
Requires write permission (android.permission.WRITE_EXTERNAL_STORAGE) in AndroidManifest.xml of the application under test.
name - the name to give the screenshot
public void takeScreenshot(String name,
int quality)
Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/).
Requires write permission (android.permission.WRITE_EXTERNAL_STORAGE) in AndroidManifest.xml of the application under test.
name - the name to give the screenshotquality - the compression rate. From 0 (compress for lowest size) to 100 (compress for maximum quality)public void startScreenshotSequence(String name)
Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/).
The name prefix is appended with "_" + sequence_number for each image in the sequence,
where numbering starts at 0.
Requires write permission (android.permission.WRITE_EXTERNAL_STORAGE) in AndroidManifest.xml of the application under test.
At present multiple simultaneous screenshot sequences are not supported.
This method will throw an exception if stopScreenshotSequence() has not been
called to finish any prior sequences.
Calling this method is equivalend to calling startScreenshotSequence(name, 80, 400, 100);
name - the name prefix to give the screenshot
public void startScreenshotSequence(String name,
int quality,
int frameDelay,
int maxFrames)
Solo.Config objects save path (default set to: /sdcard/Robotium-Screenshots/).
The name prefix is appended with "_" + sequence_number for each image in the sequence,
where numbering starts at 0.
Requires write permission (android.permission.WRITE_EXTERNAL_STORAGE) in the
AndroidManifest.xml of the application under test.
Taking a screenshot will take on the order of 40-100 milliseconds of time on the
main UI thread. Therefore it is possible to mess up the timing of tests if
the frameDelay value is set too small.
At present multiple simultaneous screenshot sequences are not supported.
This method will throw an exception if stopScreenshotSequence() has not been
called to finish any prior sequences.
name - the name prefix to give the screenshotquality - the compression rate. From 0 (compress for lowest size) to 100 (compress for maximum quality)frameDelay - the time in milliseconds to wait between each framemaxFrames - the maximum number of frames that will comprise this sequencepublic void stopScreenshotSequence()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||