Before you begin this chapter we would expect you to complete the previous chapters i.e. “Testsigma Sample Application”, “Create a Project”.


TABLE OF CONTENTS


UI Identifiers is nothing but the element locators that we use to automate/interact with page elements on Android Native apps. These UI Identifiers contain the necessary details about the objects/elements to locate them in the page during the automation process.

If you are familiar with Selenium, it is equivalent to Locators(By).


If you want to know what is UI Identifier and why it is required, go through the following article - How to create UI Identifiers - Walkthrough.


In this section of the tutorial, we will create the UI Identifiers needed to create the sample test case described in the previous chapter “Testsigma Sample Application”. We assume that you have created the Sample Project as explained in the previous chapter “Create a Project” and we will add these UI Identifiers in that sample Project.


There are 3 different ways in which you can get these UI Identifier details from your application. 

Click here to learn the ways for capturing UI Identifiers.


Here in this chapter, we will take the simple and recommended approach, i.e. using our Mobile Inspector for getting the application elements information.


Steps to obtain UI Identifiers

Testsigma uses Mobile Inspector to get the UI Identifiers in Android Native applications.

Once you have started the Inspector session, we can Inspect Apps via the Inspector to get the UI Identifiers easily. 


Here's how it is done:


1. Go to the UI Identifiers Page in the Testsigma app by navigating to Test Development -> UI Identifiers.

Click on Record button to start recording the app elements (for the APK which has been uploaded in the Uploads section):


2. After clicking on Record, the below window will pop-up asking for further details. You will be getting 2 options for capturing the elements:


2.1 - Inspect using Physical Device

Use this option if you are going to inspect elements using a local mobile device connected to this machine or using an Emulator.


We would recommend you to always use Physical Device option if possible. Remember that using a cloud device for Mobile Inspector will use up one of your available parallel runs temporarily until the Inspector is closed.


Select Agent: Here you can select the Agent which you have registered after downloading the Testsigma agent from the Agents page. The Offline agents will be grayed-out and you can only select the online Agents.


Select Device: Since we have chosen the Physical device option in the Inspector, we need to connect our real mobile device to the system after switching the development mode on in the mobile device. You can also go to the Agent page from the left pane and click on your Agent to confirm if your mobile device is connected to the system:


Upload App or Add Manually: Here you can select the APK file name which you have uploaded in the Uploads tab or you can even go for the Manually option where you can give the App package and App activity name if the app is already installed in your device.

After entering all the information, click on the Record button to start the Inspection.


2.2 - Inspect using Cloud Device

Use this option if you are going to inspect elements using a cloud device from Testsigma Lab.


Select Agent: Here you can select the Agent which you have registered after downloading the Testsigma agent from the Agents page. The Offline agents will be grayed-out and you can only select the online Agents.


Select Version and device: Select the Android version and Android Device on which you want to run your application and start the inspection of elements.


Select Uploaded App: Here you can select the APK file which you have uploaded in the Uploads tab


After entering all the information, click on the Record button to start the Inspection.


3. After clicking on the record option, you will be able to see the below Android Inspector screen with the application(Wikipedia, sample app):


There are two sections for the Android inspector displayed:

Record UI Identifier: This is the application view. An Activity of the App being inspected can be viewed here.

Selected Elements: The selected element details are shown in this tab.


In the Record UI Identifier section, there are few buttons given in the pane next to the app view:


Mirroring Mode: This mode enables the device screen mirroring and you can interact in real-time with the device.

Inspection Mode: This mode is used for capturing the element details.

Do Swipe Action: For performing any swipe action in the application.

Do click Action: For clicking on elements in the application.

Go Back: For going back to the previous page of the app.

Refresh: For refreshing the current page.

Show source tree: To check out the source code for any element.


4. Click on the Inspection Mode from the pane and start recording the actions/element details.


5. Once in Inspection mode, highlight the element which you need to capture and enter the details in the 3rd section "UI Identifier form" from the selected Element section:

In the Selected Element section you will get three options for performing the functions:

Tap: Tap on the highlighted element.

Enter Data: Enter some data in the app element.

Clear: Clear the data entered.


Also, in the UI Identifier Form section, you need to enter the details for the selected element to be stored as UI Identifier:

Element Name: Enter a name for the UI Identifier

Screen Name: Enter a Screen name for the UI Identifier for filtering and organising.

Identifier Type: Select the Identifier type for this element from the available list of locator types.

Identifier value: Enter the Identifier value if not auto-populated by the recorder.


6. After entering the details, click on Done button for storing the Recorded elements to Testsigma UI Identifiers.


7. Repeat the steps 5&6 again until all the required UI Identifiers are captured. Once all the elements are recorded, please close the Android Inspector session and then proceed towards writing the Test cases.


Note: If there are any challenges in recording the desired elements or if you feel that the captured element details are not working as expected you may talk to us on inbuilt chat at the bottom left corner or write to support@testsigma.com


Once you capture all UI Identifier required as per the example test case explained in Sample Test Case, you may go to the next chapter in this tutorial Create Test Case


***