App & Browser Testing Made Easy

Give your users a seamless experience by testing on 3000+ real devices and browsers. Don't compromise with emulators and simulators

Get Started free
Home Guide Understanding Appium Desktop: Tutorial

Understanding Appium Desktop: Tutorial

By Garima Tiwari, Community Contributor -

With the growing demand for applications that serve, delight and retain users, the need for automation testing has become prominent. As users expect that a new app version with advanced features will be launched every few weeks, automation testing helps application development and testing professionals deliver high-end apps within tight deadlines.

Appium is widely used for automated mobile app testing. It helps execute automated tests on native and hybrid apps for faster and accurate results. This article will explore how to perform automated app testing using Appium Desktop.

What is Appium Desktop?

Appium Desktop is an open-source Graphical User Interface application used for automated mobile application testing. It is supported by Windows, Mac, and Linux.

Appium Desktop has two main components:

  1. Appium Server
  2. Appium Desktop Inspector

While the Appium Server is used to run the automation test scripts, Appium Desktop Inspector is used for identifying the UI elements of the application under test.

Why use Appium Desktop?

Appium Desktop is an ideal tool for automated testing of native, mobile web, and hybrid applications because of the following features:

  1. It is open-source, which means testers can save the money that otherwise goes into costly licenses for tools and frameworks
  2. Using Appium Desktop, testers can connect a mobile device and perform automated tests on it
  3. Appium Desktop Inspector lets testers inspect web elements and identify their id and other details, which makes testing simpler and more accurate
  4. It allows testers to perform actions directly on the application and record them to generate the code that can be used for testing and debugging
  5. It lets testers pre-set configurations by setting up the desired capabilities for a more convenient testing process

Getting started with Appium Desktop

Before starting with the setup, it is essential to install and set up other prerequisite tools, as Appium Desktop is not a standalone testing tool.

To begin with, do the following:

  • Install Java and set up the environment variables
  • Install Android Studio and set up Android environment variables
  • Install Eclipse IDE for Java
  • Install Appium Desktop from this link and download the Appium Jars for Eclipse

Starting Appium Server

Having installed the Appium Desktop app, put the Host and Port values to start the Appium Server.

Appium Desktop

When Appium Server is running

Getting the mobile phone’s details

To test the application on a mobile phone, Appium requires the device details (Device ID/ UDID, Android Version) in addition to the appPackage and appActivity names of the application to be tested. Testers can get the Device ID by connecting it to the desktop and running ADB devices command on the command prompt.

Writing the Appium Test Script

To write the Appium Test Script, create a new project in Eclipse. Create the package and class to start writing the test script code.

In this script,(which opens the Google Chrome app on the Android mobile phone under test) the tester needs to set the Desired Capabilities and instantiate the Appium Driver.

public class AppiumTesting {

public static void main(String[] args) {

//Setting Desired Capabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", “Phone");
caps.setCapability("udid", "//Mention the UDID of phone"); 
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.0");
caps.setCapability("appPackage", "com.android.chrome");
caps.setCapability("appActivity", "com.google.android.apps.chrome.Main");
caps.setCapability("noReset", "true");

//Instantiating Appium Driver

try {
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("//Mention host url"), caps); 

} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
}

}

The UDID of the mobile phone, Android version, appPackage and appActivity details (for the Google Chrome app, in this example), fetched in the above section has to be used in the above code for setting Desired Capabilities and instantiating Appium Driver.

Run this script and the Google Chrome App will be opened on the connected mobile device.

Run Appium Tests on Real Devices for Free

Starting Appium Desktop Inspector

Appium Desktop Inspector is used to identify the UI elements of the application being tested. It works well with both real devices as well as simulators or emulators.

After starting with the Appium Server, the tester can start the Inspector Session by clicking on the Search icon on the Appium logs screen.

Appium Desktop Inspector

Click on the Search button to Start Inspector Session

Then by entering the Desired Capabilities details provided by BrowserStack App Automate, begin with the inspection of elements for the desired app and record the session on the cloud, as the connection with the device is established.

Appium Desktop Tutorial

Inspecting UI Elements using Appium Desktop Inspector

To explore the inspecting of UI Elements with Appium Desktop Inspector, let’s consider a scenario that opens the Wikipedia App and inspects its Search Bar.

As soon as the tester highlights the search bar using the cursor, they will get the details of the selected element. These details can be used in the script to perform tests on that specific element.

Inspecting Elements on Appium Desktop

Code Snippet:

driver.findElement(By.id("org.wikipedia.alpha:id/search_container")).click();

By running the code above, the tester will get the text “Google”, which has been written on the Search bar of the Wikipedia App, printed on the console.

This is how one can use Appium Desktop to run test scripts in order to perform automated testing of mobile applications.

Conclusion

Appium Desktop enables accurate and comprehensive automated testing of hybrid, native and web applications, thus ridding them of bugs, anomalies, and any issues that may harm the user experience. Of course, all Appium tests are best to run on real mobile devices because monitoring apps in real user conditions generates 100% accurate results, every time.

BrowserStack App Automate offers cloud-based access to both the latest and legacy devices (Android, iOS, and Windows) installed with real operating systems. App Automate also requires no additional setup, helping testers save precious time and meet their deadlines that much faster. Run Appium tests on thousands of real devices so that the app becomes truly cross-platform compatible.

Tags
Appium Automation Testing Mobile App Testing

Featured Articles

Appium vs Espresso: Key Differences

Appium vs XCUITest : Key Differences

App & Browser Testing Made Easy

Seamlessly test across 20,000+ real devices with BrowserStack