

Take a screenshot of the current window.įor example, to simulate a Home button press, call the UiDevice.pressHome().Press a hardware key, such as "volume up".The UiDevice class also let you perform the following You canĬall its methods to access device properties such as current orientation orĭisplay size. The UI Automator testing framework provides a UiDevice class to accessĪnd perform operations on the device on which the target app is running. Synchronization mechanisms so it's preferred for common UI tests. Note: UI Automator and Espresso have some feature overlap but Espresso has more APIs that support cross-app UI testing.For more information, see Accessing device state. An API to retrieve state information and perform operations on the targetĭevice.The key features of the UI Automator testing framework include the following: Implementation details of the target app. Opaque box-style automated tests, where the test code does not rely on internal The UI Automator testing framework is an instrumentation-based API and works Note: This framework requires Android 4.3 (API level 18) or higher. Using convenient descriptors such as the text displayed in that component or itsĬontent description.

With visible elements on a device, regardless of which Activity is inįocus, so it allows you to perform operations such as opening the Settings menu Testing across system and installed apps. UI Automator is a UI testing framework suitable for cross-app functional UI
