Mobile_Testing_understanding_using_various.pptx

ssuserac318e 0 views 11 slides Oct 24, 2025
Slide 1
Slide 1 of 11
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11

About This Presentation

This lecture helps in understanding the mobile testing


Slide Content

UNIT 3

What are Appium Locators? Locators are references or identifiers used to interact with elements in a user interface (UI).

7 Locator Strategies Supported by Appium ID Class Name Xpath Accessibility ID Android UI Automator Android View Tag (Espresso Only) iOS UI Automation

1. ID Each element has a unique ID assigned to it that helps identify and interact with it.  driver.findElementById (" IntegerA "); // for iOS dr.findElement (By.id(" android:id /text1")).click(); //for Android

2. Accessibility ID in Appium  Accessibility ID can be used for cross-platform automation, the code becomes reusable. dr.findElementByAccessibilityId ("Accessibility").click();

3. Class Name In the case of Android, the Class Name is called out as the full name of the  UIAutomator2  class. For example –  android.widget.TextView List< WebElement > buttons = driver.findElementsByClassName (" android.widget.TextView "); for( WebElement button : buttons){ System.out.println ( button.getText ()); if( button.getText ().equals("Animation")){ button.click (); } }

4. XPath Xpath should only be used when there is no ID, Name, or accessibility ID assigned to a specific UI element. XPath allows for the formulation of complex queries. MobileElement computeSumButton = driver.findElementByXPath ("(// XCUIElementTypeButton )[1]");

5. Android UI Automator (UI Automator 2) In Appium, one must send the Java code as a: string to the server executed in the application’s environment, which returns the particular elements. String selector = "new UiSelector ().text(“Cancel”)) . className (“ android.widget.Button ”))"; MobileElement element = ( MobileElement ) driver.findElement ( MobileBy.AndroidUIAutomator (selector));

Which Locator is fastest in Appium? In Appium, the  fastest locator strategy is typically the ID.

How do you Inspect Locators in Appium? 1.  Appium Inspector :  It displays the app’s interface and provides details like IDs, Accessibility IDs, XPath, and other relevant attributes for identifying elements. 2.  UI automator view (for Android) / Accessibility Inspector (for iOS):  Android and iOS have their own official tools for element inspection.

Advantages of Using Locators in Appium Cross-Platform Support:   Flexibility:   Improved Test Coverage: Test maintainability Support for Real Devices and Emulators:  
Tags