info@pragmatictesters.com +94 11 253 8512

Step 7: Locating App Elements

In order to automate android software app using Appium, you should aware about how to locate elements of the app to use them in webdriver automation software test scripts.

Since we are testing the Calculator app which is native, we cannot inspect the elements with fire-bug. Due to this reason we are going to use UI Automator Viewer.It is a tool provided by Android SDK.

Using UI Automator Viewer, we can inspect the android app component hierarchy, Inspect properties of the app components.Then we can use those element’s properties to create xpath of element and use them in automation test scripts.

Go to your SDK folder. Open tools>>uiautomatorviewer.bat (Double click on the bat file)

b25

Figure 1

b24

Figure 2

 

Figure 1:Then open your Calculator app in your virtual device and in the UI Automator viewer click Device Screenshot icon

figure 2: It will take screen shot of your Calculator to UI Automator viewer

  • Top part of the right side will show calculator app’s UI element’s hierarchy view.
  • Bottom part of the right side will show details of the selected element.

All you need to do is click on the element you need. It will show you the relative details of the element.

Now you can use these details to get the Xpath of the elements which you need (You can refer our blog Mastering XPath for Selenium Test Automation to learn how to get the Xpath)

 

 

Back to Tutorial 01 Back to Tutorial 02 Back to Tutorial 03 Back to Tutorial 04 Back to Tutorial 05 Back to Tutorial 06

Author: surangi_ptl

Your Turn To Talk

Leave a reply:

Your email address will not be published.