Skip to main content
Version: 3.0.0

Placing the keyboard focus on a specific view

As users can navigate your app using a keyboard (by pressing the TAB key, for example), it may be desirable to place the keyboard focus on a specific View prior to taking a screenshot.

See Support keyboard navigation for more information about keyboard navigation on Android.

In order to place the keyboard focus on a specific View, configure the focusTargetId property.

@ScreenshotInstrumentation
@Test
fun default() {
rule
.configure {
focusTargetId = R.id.fab
}
.assertSame()
}