Site Loader
Auckland, New Zealand
In the last post we discussed how to automate android web apps using Appium, in this post we will discuss how to automate an android native app using Appium. For automating a mobile Native application, we need to first set the
  • Desired capability
  • Identify the control (elements of UI)
  • Write the code to perform operation
Here is the complete code for the above discussion.
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, "MainActivity");

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


	public void SimpleTest() {


		// Get the result 
		String result = driver.findElementById("txtResult").getText();



Here is the complete video of 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

One Reply to “Automating Native apps using Appium”

  1. Hello Karthik,

    I am trying to automate mobile application but I am unable to find element on emulator and unable to click on any element in myy physical device but in appium console result printing as click success,
    below is my code
    public static void testhjg() throws MalformedURLException, InterruptedException {
    File classpathRoot = new File(System.getProperty(“user.dir”));
    File appDir = new File(classpathRoot, “APP”);
    File app = new File(appDir, “app-release (3).apk”);
    DesiredCapabilities capabilities =new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.BROWSER_NAME, “”);
    capabilities.setCapability(“deviceName”, “56123adf”);
    // capabilities.setCapability(“platformVersion”, “8.1.0”);
    capabilities.setCapability(“platformVersion”, “6.0.1”);
    capabilities.setCapability(“platformName”, “Android”);
    capabilities.setCapability(“autoGrantPermissions”, true);
    capabilities.setCapability(“app”, app.getAbsolutePath());
    capabilities.setCapability(“appPackage”, APPDetails.appPackage);
    capabilities.setCapability(“appActivity”, APPDetails.appActivity);
    // capabilities.setCapability(“app-wait-activity”, “com.parkquility.ui.authentication.AuthenticationActivity”);
    // capabilities.setCapability(“app-wait-activity”, “com.parkquility.ui.home.HomeActivity”);
    capabilities.setCapability(“app-wait-activity”, “com.parkquility.ui.Profile.ProfileActivity”);


    driver= new AndroidDriver(new URL(“”), capabilities);
    driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);//

    WebElement ProfileTab = driver.findElementById(“payment_profile_button”);
    WebDriverWait wait = new WebDriverWait(driver, 2000);

Leave a Reply to Lakshmi Cancel reply

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