Skip to content

Jetpack Compose Support

The Espresso driver supports basic interactions with Jetpack Compose-based applications.

Unlike the UiAutomator2 driver, which allows interacting with Compose elements via the accessibility layer, using the testTag attribute or the displayed text, the Espresso driver allows accessing Jetpack Compose elements directly.

Enabling Compose Mode

Support for Compose apps is based on the concept of subdrivers. This works similarly to Appium's Context API: while contexts are used to switch between native and web, subdrivers are used to switch between standard Espresso and Jetpack Compose modes, while still operating in the native context. Each subdriver operates its own elements cache, so it is not possible to mix Espresso and Compose elements.

The active subdriver can be changed at any time using the driver setting. When this setting is set to compose, the driver switches to Compose mode, changing the behavior of various endpoints and execute methods.

Supported APIs

The following driver functionality has Compose mode-specific behavior:

Calling other driver element-specific APIs not listed above would most likely throw an exception.

Troubleshooting

Refer to the Jetpack Compose Issues guide for handling potential issues.

More Resources

For more information on Compose-based driver usage and capability setup, refer to end-to-end tests: