Site Loader
Auckland, New Zealand
In the last post we discussed locating element using ID and in this post we will start to locate element of Android application using
  • Class Name
  • Accessibility ID
  • ID
Here is the complete code for identifying control using different locators.
public class FirstAppiumTest {

	// Create instance for Appium Driver
	AppiumDriver driver;

	public void Setup() throws MalformedURLException {

		DesiredCapabilities cap = new DesiredCapabilities();
		cap.setCapability(MobileCapabilityType.DEVICE_NAME, "donatello");
		cap.setCapability(MobileCapabilityType.APP_ACTIVITY, "Calculator");
		// cap.setCapability("avd", "Test");

		driver = new AndroidDriver(new URL(
				""), cap);


	public void SimpleTest() {

		// Click 5
		// Click 5
		// Click 5
		// Click 5
		// Click 5


		// Verify the result
		String result = driver

		if (result.equals("149"))


As you can see from the above code, we have also used the getText() method to get the text out from a control and verified if the text is as expected. Here is the complete video for the above discussion Thanks for reading the post and watching the video !!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK

Post Author: Karthik kk

3 Replies to “Locating elements in Appium (Part b)”

  1. Hi Karthik,

    Session was good , but I have real time issue in using “content-desc” value in findelementbyaccessibilityid.
    for emulator “content-desc” value is showing it as “equals” but for real devices , it may show it as “equals button” . This kind of behavior i observed in real time apps particularly for image buttons. Because of this ,scripts written in real devices using accessibility locator strategy are not working in emulator vice-versa.

    you can check app “Safeway” available in Playstore.

    Kiran Edupuganti

  2. Accidentally I visited this site. Good videos. I am into Mobile Automation testing and I would want to keep in contact with you.

Leave a Reply

Your email address will not be published. Required fields are marked *