Download Ui Automator Viewer

We learnt how to use UI Automator Viewer in PREVIOUS POST to locate and get properties details of android native software app's any element.Now we need to learn what are the different ways to locate elements of android software app and how to. UI Automator Viewer is a GUI tool that comes with Android SDK which is used to inspect UI components of an Android Application and view the properties associated. We can find it in Android SDK “tools” folder with file name 'uiautomatorviewer.bat' on Windows. This will open UI Automator Viewer window as displayed below. Sdkmanager -list if you see some local repositories are getting download, That means everything is.

  1. Ui Automator Viewer Download
  2. Download Ui Automator Viewer For Mac
  3. Ui Automator Viewer Free Download

In this document

  • uiautomator API

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.

For more information on testing with the uiautomator framework, see UI Testing.

Syntax

To run your testcases on the target device, you can use the adb shell command to invoke the uiautomator tool. The syntax is:

Here’s an example:

Automator

Command-line Options

Ui Automator Viewer Download

The following table describes the subcommands and options for uiautomator.

Table 1. Command-line options for uiautomator

SubcommandOptionDescription
runtest<JARS>Required. The <JARS> argument is the name of one or more JAR files that you deployed to the target device which contain your uiautomator testcases. You can list more than one JAR file by using a space as a separator.
-c <CLASSES> Required (API 17 or lower).The <CLASSES> argument is a list of test classes or test methods in <JARS> to run.

Each class or method must be fully qualified with the package name, in one of these formats:

  • package_name.class_name
  • package_name.class_name#method_name
You can list multiple classes or methods by using a space as a separator.

Note:This argument is not required for API 18 and higher. If not specified, all test cases in <JARS> will be run.

--nohupRuns the test to completion on the device even if its parent process is terminated (for example, if the device is disconnected).
-e <NAME> <VALUE>

Specify other name-value pairs to be passed to test classes. May be repeated.

Note: The -e options cannot be combined; you must prefix each option with a separate -e flag.

-e debug [true|false]Wait for debugger to connect before starting.
dump [file]Generate an XML file with a dump of the current UI hierarchy. 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.
-e outputFormat simple | -sEnables less verbose JUnit style output.
eventsPrints out accessibility events to the console until the connection to the device is terminated

uiautomator API

The uiautomator API is bundled in the uiautomator.jar file under the <android-sdk>/platforms/ directory. The API includes these key classes, interfaces, and exceptions that allow you to capture and manipulate UI components on the target app:

Download Ui Automator Viewer For Mac

Download Ui Automator Viewer

Classes

ClassDescription
com.android.uiautomator.core.UiCollectionUsed 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.
com.android.uiautomator.core.UiDeviceProvides access to state information about the device. 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.
com.android.uiautomator.core.UiObjectRepresents a user interface (UI) element.
com.android.uiautomator.core.UiScrollableProvides support for searching for items in a scrollable UI container.
com.android.uiautomator.core.UiSelectorRepresents a query for one or more target UI elements on a device screen.
com.android.uiautomator.core.ConfiguratorAllows you to set key parameters for running uiautomator tests.

Interfaces

InterfaceDescription
com.android.uiautomator.core.UiWatcherRepresents a conditional watcher on the target device.
com.android.uiautomator.testrunner.IAutomationSupportProvides auxiliary support for running test cases.
com.android.uiautomator.testrunner.UiAutomatorTestCaseDefines an environment for running multiple tests. All uiautomator test cases should extend this class.

Exceptions

Ui Automator Viewer Free Download

ExceptionDescription
com.android.uiautomator.core.UiObjectNotFoundExceptionIndicates when a a UiSelector could not be matched to any UI element displayed.

Comments are closed.