
Represents a user interface (UI) element.Ĭom. You can also use this class to simulate user actions on the device, such as pressing the d-pad hardware button or pressing the Home and Menu buttons. Provides access to state information about the device. Used to enumerate a container's user interface (UI) elements for the purpose of counting, or targeting a sub elements by a child's text or description. The API includes these key classes, interfaces, and exceptions that allow you to capture and manipulate UI components on the target app: Classes ClassĬom. The uiautomator API is bundled in the uiautomator.jar file under the /platforms/ directory.


Prints out accessibility events to the console until the connection to the device is terminated If a filepath is not specified, by default, the generated dump file is stored on the device in this location /storage/sdcard0/window_dump.xml. Generate an XML file with a dump of the current UI hierarchy. Wait for debugger to connect before starting. Note: The -e options cannot be combined you must prefix each option with a separate -e flag. Specify other name-value pairs to be passed to test classes. Runs the test to completion on the device even if its parent process is terminated (for example, if the device is disconnected). You can list multiple classes or methods by using a space as a separator. The argument is a list of one or more specific test classes or test methods from the JARs that you want uiautomator to run.Įach class or method must be fully qualified with the package name, in one of these formats: You can list more than one JAR file by using a space as a separator. The argument is the name of one or more JAR files that you deployed to the target device which contain your uiautomator testcases. Command-line options for uiautomator Subcommand The following table describes the subcommands and options for uiautomator. Here’s an example: adb shell uiautomator runtest LaunchSettings.jar -c .LaunchSettings Command-line Options The syntax is:Īdb shell uiautomator runtest -c

To run your testcases on the target device, you can use the adb shell command to invoke the uiautomator tool. The uiautomator testing framework lets you test your user interface (UI) efficiently by creating automated functional UI testcases that can be run against your app on one or more devices.įor more information on testing with the uiautomator framework, see UI Testing.
