Book Image

Appium Essentials

Book Image

Appium Essentials

Overview of this book

Table of Contents (14 chapters)

Automating native apps


Native apps are basically developed for a particular platform, and they can take an advantage of the device's features. They can work offline. You can install a native app directly on to the device or through an application store, such as Google Play or Apple App Store.

Native Android apps

Here, we are going to take an example of the Android calculator app, and in this section, we will take a look at the addition of two numbers.

Perform the following steps to automate the calculator app:

  1. Update the desired capabilities in the setup() method to launch the calculator app:

    caps.setCapability("avd","AVD_Nexus_4");// Mention the created AVD name
    caps.setCapability(MobileCapabilityType.APP_PACKAGE, "com.android.calculator2");
    caps.setCapability(MobileCapabilityType.APP_ACTIVITY, "com.android.calculator2.Calculator");
  2. Now, we need to find the numbers; we are going to find them by name:

    WebElement five=driver.findElement(By.name("5"));
    WebElement four=driver.findElement(By.name(...