Home » appium-tutorial » Identify Element Using UIAutomatorViewer

Newly Updated Posts

Identify Element Using UIAutomatorViewer

Previous topic, In this tutorial we will learn locate or Identify Element Using UIAutomatorViewer. Let discuss in depth.

Why and how to check device connectivity?

In initial step, connect your mobile device with local system or computer and check your device connectivity. This can be done by two ways:

First way is go to open perspective->select DDMS and click to ok button and the connected device will be displayed under the devices list as shown blow.

DDMS view in eclipse

Second way is hit command-> adb devices under cmd prompt or command prompt as below.

pda net installation

How to Identify Element Using UIAutomatorViewer?

Follow the below steps for locating the elements:

Step 1) Open the application on your mobile device (as we are working on Flipkart, will identify its element.

Step 2) Browse the android folder till the uiautomatorviewer.bat file, or follow the below path->C:\Users\xxxxxx\AppData\Local\Android\android-sdk\tools\bin and double click to uiautomatorviewer .bat file.

Identify Element Using UIAutomatorViewer

Step 3) As we hit to uiautomatorviewer.bat file, a UI Automatoe viewer will get opened.

Locate Element Using UIAutomatorViewer

Step 4) Click in to device screenshot button available as second menu on the top. The screenshot for the flipkart application will get opened. (Note: keep flipkart application opened on mobile device).

Identify Element Using UIAutomatorViewer

Step 5) Now click to Main Menu on the top of the screenshot and all the properties of the element will get displayed on the right.

Identify Element Using UIAutomatorViewer

Step 6) Now click to search field on the flipkart application screenshot, similarly all the attribute along its values will be displayed on the bottom right.

Identify Element Using UIAutomatorViewer

Now lets understand how to save the screenshot and its related files.

How to save screenshot and UiX File?

It is very important to save your screenshot and its related UiX file because, one need to take screenshot again and again for the same page and check for device connectivity.

With the save feature inside the UI Automation viewer, once can save the screenshot of the application and UiX file and can use later even when the devices is not connected with computer.

Steps to save the screeshot along with Uix File are below:

Step 1) Take the screenshot of the flipkart application and click to save button on the top.

UIAutomatorViewer_3

Step 2) Now give the path and click to OK button.

Step 3) now go the that path and you will see that 2 files are created on the location.

UIAutomatorViewer_4

The two files are created in the same location one is the screenshot and other is the properties of all the elements displayed in the screenshot.

How can we open the saved UI files?

Below are the steps to open the saved UI files:

Step 1) Click on the open menu at the top.

UIAutomatorViewe_5

Step 2) click on to browser and give the path of dump file , on the saved location.

UIAutomatorViewer_6

Step 3) Screenshot of flipkart application alon with properties values gets displayed under UI Automator viewer now.

UIAutomatorViewer_7

So following the above steps we are now good with locating or identifying the elements of any Android application for Appium automation.

Youtube->https://www.youtube.com/channel/UCJmuzLmF7txuObVRHXYTGZQ?view_as=subscriber