# PickerActions

# PickerActions

Artifact:[androidx.test.espresso:espresso-contrib](https://developer.android.com/jetpack/androidx/releases/test-espresso)  
[View Source](https://cs.android.com/search?q=file:androidx/test/espresso/contrib/PickerActions.java+class:androidx.test.espresso.contrib.PickerActions)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/test/espresso/contrib/PickerActions "View this page in Java")

<br />

```
class PickerActions
```

<br />

*** ** * ** ***

Espresso action for interacting with[DatePicker](https://developer.android.com/reference/android/widget/DatePicker.html)and[TimePicker](https://developer.android.com/reference/android/widget/TimePicker.html).

See[Pickers API guide](http://developer.android.com/guide/topics/ui/controls/pickers.html)

## Summary

|                                              ### Public functions                                               |
|-----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)`!` | [setDate](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/PickerActions#setDate(int,int,int))`(year: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, monthOfYear: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, dayOfMonth: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns a[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)that sets a date on a[DatePicker](https://developer.android.com/reference/android/widget/DatePicker.html). |
| `java-static `[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)`!` | [setTime](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/PickerActions#setTime(int,int))`(hours: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, minutes: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns a[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)that sets a time on a[TimePicker](https://developer.android.com/reference/android/widget/TimePicker.html).                                                                                                   |

## Public functions

### setDate

```
java-static fun setDate(year: Int, monthOfYear: Int, dayOfMonth: Int): ViewAction!
```

Returns a[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)that sets a date on a[DatePicker](https://developer.android.com/reference/android/widget/DatePicker.html).  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|----------------------------------------|
| `year: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)        | The year.                              |
| `monthOfYear: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The month which is starting from zero. |
| `dayOfMonth: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | The day of the month.                  |

### setTime

```
java-static fun setTime(hours: Int, minutes: Int): ViewAction!
```

Returns a[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)that sets a time on a[TimePicker](https://developer.android.com/reference/android/widget/TimePicker.html).  

|                                       Parameters                                       |
|----------------------------------------------------------------------------------------|-----------------------------------------|
| `hours: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)   | the hour to set, in the range (0-23).   |
| `minutes: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the minute to set, in the range (0-59). |