Find Element in Appium

Let’s see How can you find element in Appium. In the previous tutorial, You have seen How can you open the UI Automator.


Now you will see, How can you find the elements of an Andriod App using UI Automator.

I am expecting that you are coming to this chapter by following the complete tutorial of Appium from very Start.


Now you will see, How to locate the elements using UI Automator. There are finite steps to locate the Andriod app Elements.

  • The first step, Connect you device to your PC.

  • Check using DDMS in eclipse that device is connected properly or not.

  • Start the UI Automator using UIAutomator.bat file.

  • Now open your application in your mobile phone.

  • Now click on the icon Device Screen Shot in UI Automator.


Find Element using UI Automator


After click on the Screen Shot Icon, UI Automator will take some time and it will capture the screenshot of your Opened Application’s page.


You can see in the above attached image, I am using the Andriod Application ‘Carwale’ and after click on the Screen Shot icon, I got the image on my opened page in UI Automator.

You can see that a device image is displayed on the left side of the UIAutomator window with the detailed information of the tree nodes on the right side and the properties information on the bottom right side.


Click any element on the page and look at the right side of Node detail window. It displays the information of elements in the tree structure.

You can click on any icon to display elements property. You can see, this is different from the elements what you used in Web Applications.


In Andriod we have different Layouts, In the UI Automator Tree nodes layout you can see, each and every layout is inside the FrameLayout.


Now let’s understand the Element in our Application Page. In my App, I am going to explore “FIND CAR” button, present on my page.

Find Element using UI Automator


You can see As you clicked on the “FIND CARbutton. Button got highlighted and in the Properties, We got all properties of this button. Like text, class, ID and Package.

Resource-Id is the ID of this Element and Class is the Class of this element. In Android class always starts with android.widget


Now we will see, How can we locate the element. Let’s script a simple Test enter the car name and Search for it.

Steps –

  1. Open the Application

  2. Enter the Car Name

  3. Click on FIND CAR button.

In the above test Script, We are opening the CarWale Application & performing our Test Case.


NoteIf you are facing any issue in running this code then please start from very first tutorial ofAPPIUM, because you need to be done a lot of setting to execute this Test Script on your local machine.


Using this way, You can find the Elements in Andriod App and perform Actions on these elements.

0 Comment

Leave a Reply