# ViewActions

Summary:[Methods](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#)  

# ViewActions

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
ViewActions
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object.html)`


``


`

|---|--------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.test.espresso.action.ViewActions |

<br />

*** ** * ** ***

A collection of common[ViewActions](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions).

## Summary

|                                                                                                                                                                                                                                                                                                                                ### Public methods                                                                                                                                                                                                                                                                                                                                ||
|----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[actionWithAssertions](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#actionWithAssertions(android.support.test.espresso.ViewAction))`(`[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction)` viewAction) ` Performs all assertions before the`ViewAction`s in this class and then performs the given`ViewAction`                                                                                                                                                               |
| ` static void`                                                                                           | ` `[addGlobalAssertion](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#addGlobalAssertion(java.lang.String, android.support.test.espresso.ViewAssertion))`(`[String](https://developer.android.com/reference/java/lang/String.html)` name, `[ViewAssertion](https://developer.android.com/reference/android/support/test/espresso/ViewAssertion)` viewAssertion) ` Adds a`ViewAssertion`to be run every time a`ViewAction`in this class is performed.                                                                        |
| ` static void`                                                                                           | ` `[clearGlobalAssertions](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#clearGlobalAssertions())`() `                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[clearText](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#clearText())`() ` Returns an action that clears text on the view.                                                                                                                                                                                                                                                                                                                                                                                              |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[click](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#click())`() ` Same as`click(int inputDevice, int buttonState)`, but uses[SOURCE_UNKNOWN](https://developer.android.com/reference/android/view/InputDevice.html#SOURCE_UNKNOWN)as the inputDevice and[BUTTON_PRIMARY](https://developer.android.com/reference/android/view/MotionEvent.html#BUTTON_PRIMARY)as the buttonState.                                                                                                                                      |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[click](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#click(int, int))`(int inputDevice, int buttonState) ` Returns an action that clicks the view for a specific input device and button state.                                                                                                                                                                                                                                                                                                                         |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[click](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#click(android.support.test.espresso.ViewAction))`(`[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction)` rollbackAction) ` Returns an action that performs a single click on the view.                                                                                                                                                                                                                                   |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[closeSoftKeyboard](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#closeSoftKeyboard())`() ` Returns an action that closes soft keyboard.                                                                                                                                                                                                                                                                                                                                                                                 |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[doubleClick](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#doubleClick())`() ` Returns an action that double clicks the view.                                                                                                                                                                                                                                                                                                                                                                                           |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[longClick](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#longClick())`() ` Returns an action that long clicks the view.                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[openLink](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#openLink(org.hamcrest.Matcher<java.lang.String>, org.hamcrest.Matcher<android.net.Uri>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> linkTextMatcher, Matcher<`[Uri](https://developer.android.com/reference/android/net/Uri.html)`> uriMatcher) ` Returns an action that opens a link matching the given link text and uri matchers.                                                                                   |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[openLinkWithText](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#openLinkWithText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` linkText) ` Same as`openLinkWithText(Matcher<String> linkTextMatcher)`, but uses`is(linkText)`as the linkTextMatcher.                                                                                                                                                                                                                    |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[openLinkWithText](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#openLinkWithText(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> linkTextMatcher) ` Same as`openLink(Matcher<String> linkTextMatcher, Matcher<Uri> uriMatcher)`, but uses`any(Uri.class)`as the uriMatcher.                                                                                                                                                                |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[openLinkWithUri](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#openLinkWithUri(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` uri) ` Same as`openLinkWithUri(Matcher<Uri> uriMatcher)`, but uses`is(uri)`as the uriMatcher.                                                                                                                                                                                                                                              |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[openLinkWithUri](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#openLinkWithUri(org.hamcrest.Matcher<android.net.Uri>))`(Matcher<`[Uri](https://developer.android.com/reference/android/net/Uri.html)`> uriMatcher) ` Same as`openLink(Matcher<String> linkTextMatcher, Matcher<Uri> uriMatcher)`, but uses`any(String.class)`as the linkTextMatcher.                                                                                                                                                                    |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[pressBack](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#pressBack())`() ` Returns an action that clicks the back button.                                                                                                                                                                                                                                                                                                                                                                                               |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[pressBackUnconditionally](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#pressBackUnconditionally())`() ` Similar to[pressBack()](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#pressBack())but will**not**throw an exception when Espresso navigates outside the application or process under test.                                                                                                                                                                          |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[pressImeActionButton](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#pressImeActionButton())`() ` Returns an action that presses the current action button (next, done, search, etc) on the IME (Input Method Editor).                                                                                                                                                                                                                                                                                                   |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[pressKey](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#pressKey(int))`(int keyCode) ` Returns an action that presses the key specified by the keyCode (eg.                                                                                                                                                                                                                                                                                                                                                             |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[pressKey](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#pressKey(android.support.test.espresso.action.EspressoKey))`(`[EspressoKey](https://developer.android.com/reference/android/support/test/espresso/action/EspressoKey)` key) ` Returns an action that presses the specified key with the specified modifiers.                                                                                                                                                                                                    |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[pressMenuKey](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#pressMenuKey())`() ` Returns an action that presses the hardware menu key.                                                                                                                                                                                                                                                                                                                                                                                  |
| ` static void`                                                                                           | ` `[removeGlobalAssertion](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#removeGlobalAssertion(android.support.test.espresso.ViewAssertion))`(`[ViewAssertion](https://developer.android.com/reference/android/support/test/espresso/ViewAssertion)` viewAssertion) ` Removes the given assertion from the set of assertions to be run before actions are performed.                                                                                                                                                        |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[repeatedlyUntil](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#repeatedlyUntil(android.support.test.espresso.ViewAction, org.hamcrest.Matcher<android.view.View>, int))`(`[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction)` action, Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`> desiredStateMatcher, int maxAttempts) ` Returns an action that performs given`ViewAction`on the view until view matches the desired`Matcher<View>`. |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[replaceText](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#replaceText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` stringToBeSet) ` Returns an action that updates the text attribute of a view.                                                                                                                                                                                                                                                                      |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[scrollTo](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#scrollTo())`() ` Returns an action that scrolls to the view.                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[swipeDown](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#swipeDown())`() ` Returns an action that performs a swipe top-to-bottom across the horizontal center of the view.                                                                                                                                                                                                                                                                                                                                              |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[swipeLeft](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#swipeLeft())`() ` Returns an action that performs a swipe right-to-left across the vertical center of the view.                                                                                                                                                                                                                                                                                                                                                |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[swipeRight](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#swipeRight())`() ` Returns an action that performs a swipe left-to-right across the vertical center of the view.                                                                                                                                                                                                                                                                                                                                              |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[swipeUp](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#swipeUp())`() ` Returns an action that performs a swipe bottom-to-top across the horizontal center of the view.                                                                                                                                                                                                                                                                                                                                                  |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[typeText](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#typeText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` stringToBeTyped) ` Returns an action that selects the view (by clicking on it) and types the provided string into the view.                                                                                                                                                                                                                              |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[typeTextIntoFocusedView](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#typeTextIntoFocusedView(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` stringToBeTyped) ` Returns an action that types the provided string into the view.                                                                                                                                                                                                                                         |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||

## Public methods

### actionWithAssertions

```
ViewAction actionWithAssertions (ViewAction viewAction)
```

Performs all assertions before the`ViewAction`s in this class and then performs the given`ViewAction`

<br />

|                                    Parameters                                     ||
|--------------|---------------------------------------------------------------------|
| `viewAction` | `ViewAction`: the`ViewAction`to perform after the assertions <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### addGlobalAssertion

```
void addGlobalAssertion (String name, 
                ViewAssertion viewAssertion)
```

Adds a`ViewAssertion`to be run every time a`ViewAction`in this class is performed. The assertion will be run prior to performing the action.

<br />

|                              Parameters                               ||
|-----------------|------------------------------------------------------|
| `name`          | `String`: a name of the assertion to be added <br /> |
| `viewAssertion` | `ViewAssertion`: a`ViewAssertion`to be added <br />  |

|                                                                                           Throws                                                                                           ||
|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if the name/viewAssertion pair is already contained in the global assertions. |

### clearGlobalAssertions

```
void clearGlobalAssertions ()
```

<br />

<br />

### clearText

```
ViewAction clearText ()
```

Returns an action that clears text on the view.  

View constraints:

- must be displayed on screen

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### click

```
ViewAction click ()
```

Same as`click(int inputDevice, int buttonState)`, but uses[SOURCE_UNKNOWN](https://developer.android.com/reference/android/view/InputDevice.html#SOURCE_UNKNOWN)as the inputDevice and[BUTTON_PRIMARY](https://developer.android.com/reference/android/view/MotionEvent.html#BUTTON_PRIMARY)as the buttonState.

<br />

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### click

```
ViewAction click (int inputDevice, 
                int buttonState)
```

Returns an action that clicks the view for a specific input device and button state.

**Note:** Not supported by API \< 14. An[UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException.html)will be thrown if called on API \< 14. For API \< 14, call[click()](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#click())instead.  

View constraints:

- must be displayed on screen

  |                                                                                     Parameters                                                                                     ||
  |---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | `inputDevice` | `int`: source input device of the click. Example:[SOURCE_MOUSE](https://developer.android.com/reference/android/view/InputDevice.html#SOURCE_MOUSE) <br />          |
  | `buttonState` | `int`: buttonState associated with the click. Example:[BUTTON_PRIMARY](https://developer.android.com/reference/android/view/MotionEvent.html#BUTTON_PRIMARY) <br /> |

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### click

```
ViewAction click (ViewAction rollbackAction)
```

Returns an action that performs a single click on the view.

If the click takes longer than the 'long press' duration (which is possible) the provided rollback action is invoked on the view and a click is attempted again.

This is only necessary if the view being clicked on has some different behaviour for long press versus a normal tap.

For example - if a long press on a particular view element opens a popup menu - ViewActions.pressBack() may be an acceptable rollback action.  
View constraints:

- must be displayed on screen
- any constraints of the rollbackAction

  |              Parameters               ||
  |------------------|---------------------|
  | `rollbackAction` | `ViewAction` <br /> |

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### closeSoftKeyboard

```
ViewAction closeSoftKeyboard ()
```

Returns an action that closes soft keyboard. If the keyboard is already closed, it is a no-op.

<br />

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### doubleClick

```
ViewAction doubleClick ()
```

Returns an action that double clicks the view.  

View preconditions:

- must be displayed on screen

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### longClick

```
ViewAction longClick ()
```

Returns an action that long clicks the view.  

View preconditions:

- must be displayed on screen

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### openLink

```
ViewAction openLink (Matcher<String> linkTextMatcher, 
                Matcher<Uri> uriMatcher)
```

Returns an action that opens a link matching the given link text and uri matchers. The action is performed by invoking the link's onClick method (as opposed to actually issuing a click on the screen).  

View preconditions:

- must be displayed on screen
- must be assignable from TextView
- must have links

  |             Parameters              ||
  |-------------------|------------------|
  | `linkTextMatcher` | `Matcher` <br /> |
  | `uriMatcher`      | `Matcher` <br /> |

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### openLinkWithText

```
ViewAction openLinkWithText (String linkText)
```

Same as`openLinkWithText(Matcher<String> linkTextMatcher)`, but uses`is(linkText)`as the linkTextMatcher.

<br />

|         Parameters          ||
|------------|-----------------|
| `linkText` | `String` <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### openLinkWithText

```
ViewAction openLinkWithText (Matcher<String> linkTextMatcher)
```

Same as`openLink(Matcher<String> linkTextMatcher, Matcher<Uri> uriMatcher)`, but uses`any(Uri.class)`as the uriMatcher.

<br />

|             Parameters              ||
|-------------------|------------------|
| `linkTextMatcher` | `Matcher` <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### openLinkWithUri

```
ViewAction openLinkWithUri (String uri)
```

Same as`openLinkWithUri(Matcher<Uri> uriMatcher)`, but uses`is(uri)`as the uriMatcher.

<br />

|       Parameters       ||
|-------|-----------------|
| `uri` | `String` <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### openLinkWithUri

```
ViewAction openLinkWithUri (Matcher<Uri> uriMatcher)
```

Same as`openLink(Matcher<String> linkTextMatcher, Matcher<Uri> uriMatcher)`, but uses`any(String.class)`as the linkTextMatcher.

<br />

|           Parameters           ||
|--------------|------------------|
| `uriMatcher` | `Matcher` <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### pressBack

```
ViewAction pressBack ()
```

Returns an action that clicks the back button.

<br />

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

|                                                                                      Throws                                                                                      ||
|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [PerformException](https://developer.android.com/reference/android/support/test/espresso/PerformException) | if Espresso navigates outside the application or process under test. |

### pressBackUnconditionally

```
ViewAction pressBackUnconditionally ()
```

Similar to[pressBack()](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions#pressBack())but will**not**throw an exception when Espresso navigates outside the application or process under test.

<br />

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### pressImeActionButton

```
ViewAction pressImeActionButton ()
```

Returns an action that presses the current action button (next, done, search, etc) on the IME (Input Method Editor). The selected view will have its onEditorAction method called.

<br />

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### pressKey

```
ViewAction pressKey (int keyCode)
```

Returns an action that presses the key specified by the keyCode (eg. Keyevent.KEYCODE_BACK).

<br />

|       Parameters        ||
|-----------|--------------|
| `keyCode` | `int` <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### pressKey

```
ViewAction pressKey (EspressoKey key)
```

Returns an action that presses the specified key with the specified modifiers.

<br />

|         Parameters          ||
|-------|----------------------|
| `key` | `EspressoKey` <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### pressMenuKey

```
ViewAction pressMenuKey ()
```

Returns an action that presses the hardware menu key.

<br />

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### removeGlobalAssertion

```
void removeGlobalAssertion (ViewAssertion viewAssertion)
```

Removes the given assertion from the set of assertions to be run before actions are performed.

<br />

|                            Parameters                            ||
|-----------------|-------------------------------------------------|
| `viewAssertion` | `ViewAssertion`: the assertion to remove <br /> |

|                                                                                             Throws                                                                                             ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if the name/viewAssertion pair is not already contained in the global assertions. |

### repeatedlyUntil

```
ViewAction repeatedlyUntil (ViewAction action, 
                Matcher<View> desiredStateMatcher, 
                int maxAttempts)
```

Returns an action that performs given`ViewAction`on the view until view matches the desired`Matcher<View>`. It will repeat the given action until view matches the desired`Matcher<View>`or PerformException will be thrown if given number of unsuccessful attempts are made.

<br />

|                                                                 Parameters                                                                  ||
|-----------------------|----------------------------------------------------------------------------------------------------------------------|
| `action`              | `ViewAction`: action to be performed repeatedly <br />                                                               |
| `desiredStateMatcher` | `Matcher`: action is performed repeatedly until view matches this view matcher <br />                                |
| `maxAttempts`         | `int`: max number of times for which this action to be performed if view doesn't match the given view matcher <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### replaceText

```
ViewAction replaceText (String stringToBeSet)
```

Returns an action that updates the text attribute of a view.  

View preconditions:

- must be displayed on screen
- must be assignable from EditText

  |            Parameters            ||
  |-----------------|-----------------|
  | `stringToBeSet` | `String` <br /> |

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### scrollTo

```
ViewAction scrollTo ()
```

Returns an action that scrolls to the view.  

View preconditions:

- must be a descendant of ScrollView
- must have visibility set to View.VISIBLE

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### swipeDown

```
ViewAction swipeDown ()
```

Returns an action that performs a swipe top-to-bottom across the horizontal center of the view. The swipe doesn't start at the very edge of the view, but has a bit of offset.  

View constraints:

- must be displayed on screen

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### swipeLeft

```
ViewAction swipeLeft ()
```

Returns an action that performs a swipe right-to-left across the vertical center of the view. The swipe doesn't start at the very edge of the view, but is a bit offset.  

View constraints:

- must be displayed on screen

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### swipeRight

```
ViewAction swipeRight ()
```

Returns an action that performs a swipe left-to-right across the vertical center of the view. The swipe doesn't start at the very edge of the view, but is a bit offset.  

View constraints:

- must be displayed on screen

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### swipeUp

```
ViewAction swipeUp ()
```

Returns an action that performs a swipe bottom-to-top across the horizontal center of the view. The swipe doesn't start at the very edge of the view, but has a bit of offset.  

View constraints:

- must be displayed on screen

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### typeText

```
ViewAction typeText (String stringToBeTyped)
```

Returns an action that selects the view (by clicking on it) and types the provided string into the view. Appending a \\n to the end of the string translates to a ENTER key event. Note: this method performs a tap on the view before typing to force the view into focus, if the view already contains text this tap may place the cursor at an arbitrary position within the text.  

View preconditions:

- must be displayed on screen
- must support input methods

  |             Parameters             ||
  |-------------------|-----------------|
  | `stringToBeTyped` | `String` <br /> |

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### typeTextIntoFocusedView

```
ViewAction typeTextIntoFocusedView (String stringToBeTyped)
```

Returns an action that types the provided string into the view. Appending a \\n to the end of the string translates to a ENTER key event. Note: this method does not change cursor position in the focused view - text is inserted at the location where the cursor is currently pointed.  

View preconditions:

- must be displayed on screen
- must support input methods
- must be already focused

  |             Parameters             ||
  |-------------------|-----------------|
  | `stringToBeTyped` | `String` <br /> |

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

-

  ## Interfaces

  - [AdapterViewProtocol](https://developer.android.com/reference/android/support/test/espresso/action/AdapterViewProtocol)
  - [AdapterViewProtocol.DataFunction](https://developer.android.com/reference/android/support/test/espresso/action/AdapterViewProtocol.DataFunction)
  - [CoordinatesProvider](https://developer.android.com/reference/android/support/test/espresso/action/CoordinatesProvider)
  - [PrecisionDescriber](https://developer.android.com/reference/android/support/test/espresso/action/PrecisionDescriber)
  - [Swiper](https://developer.android.com/reference/android/support/test/espresso/action/Swiper)
  - [Tapper](https://developer.android.com/reference/android/support/test/espresso/action/Tapper)
-

  ## Classes

  - [AdapterDataLoaderAction](https://developer.android.com/reference/android/support/test/espresso/action/AdapterDataLoaderAction)
  - [AdapterViewProtocol.AdaptedData](https://developer.android.com/reference/android/support/test/espresso/action/AdapterViewProtocol.AdaptedData)
  - [AdapterViewProtocol.AdaptedData.Builder](https://developer.android.com/reference/android/support/test/espresso/action/AdapterViewProtocol.AdaptedData.Builder)
  - [AdapterViewProtocols](https://developer.android.com/reference/android/support/test/espresso/action/AdapterViewProtocols)
  - [CloseKeyboardAction](https://developer.android.com/reference/android/support/test/espresso/action/CloseKeyboardAction)
  - [EditorAction](https://developer.android.com/reference/android/support/test/espresso/action/EditorAction)
  - [EspressoKey](https://developer.android.com/reference/android/support/test/espresso/action/EspressoKey)
  - [EspressoKey.Builder](https://developer.android.com/reference/android/support/test/espresso/action/EspressoKey.Builder)
  - [GeneralClickAction](https://developer.android.com/reference/android/support/test/espresso/action/GeneralClickAction)
  - [GeneralSwipeAction](https://developer.android.com/reference/android/support/test/espresso/action/GeneralSwipeAction)
  - [KeyEventAction](https://developer.android.com/reference/android/support/test/espresso/action/KeyEventAction)
  - [MotionEvents](https://developer.android.com/reference/android/support/test/espresso/action/MotionEvents)
  - [MotionEvents.DownResultHolder](https://developer.android.com/reference/android/support/test/espresso/action/MotionEvents.DownResultHolder)
  - [OpenLinkAction](https://developer.android.com/reference/android/support/test/espresso/action/OpenLinkAction)
  - [PressBackAction](https://developer.android.com/reference/android/support/test/espresso/action/PressBackAction)
  - [RepeatActionUntilViewState](https://developer.android.com/reference/android/support/test/espresso/action/RepeatActionUntilViewState)
  - [ReplaceTextAction](https://developer.android.com/reference/android/support/test/espresso/action/ReplaceTextAction)
  - [ScrollToAction](https://developer.android.com/reference/android/support/test/espresso/action/ScrollToAction)
  - [TypeTextAction](https://developer.android.com/reference/android/support/test/espresso/action/TypeTextAction)
  - [ViewActions](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions)
-

  ## Enums

  - [GeneralLocation](https://developer.android.com/reference/android/support/test/espresso/action/GeneralLocation)
  - [Press](https://developer.android.com/reference/android/support/test/espresso/action/Press)
  - [Swipe](https://developer.android.com/reference/android/support/test/espresso/action/Swipe)
  - [Swiper.Status](https://developer.android.com/reference/android/support/test/espresso/action/Swiper.Status)
  - [Tap](https://developer.android.com/reference/android/support/test/espresso/action/Tap)
  - [Tapper.Status](https://developer.android.com/reference/android/support/test/espresso/action/Tapper.Status)