Mobile Development 12 min read

Master Appium Desktop: Setup, First Test, Element Locating & Recording

This guide walks you through installing Appium Desktop, configuring and launching the server, creating a simple Java test for the Android calculator app, exploring multiple element‑locating strategies (ID, class name, XPath, Accessibility ID, UIAutomator), and using the desktop tool’s element inspector and recording features to generate test scripts.

Software Development Quality
Software Development Quality
Software Development Quality
Master Appium Desktop: Setup, First Test, Element Locating & Recording

What is Appium Desktop?

Appium Desktop is an open‑source, cross‑platform GUI for the Appium automation server, bundling the server, an inspector, and a recorder without requiring separate Node/NPM installation.

Download

Appium Desktop can be downloaded from GitHub .

Appium Desktop UI Overview

The main window shows the host and port (default 127.0.0.1:4723) and provides buttons to start/stop the server, open the inspector, and access the recorder.

Appium Desktop main UI
Appium Desktop main UI

First Appium Test

Prerequisites: IDE (e.g., IntelliJ), JDK > 1.8, a real device or emulator, Android SDK, Maven.

Project structure:

Project directory
Project directory

CalculatorTest.java

package example;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import java.net.MalformedURLException;
import java.net.URL;
public class CalculatorTest {
    public static AndroidDriver driver;
    public static void main(String[] args) throws MalformedURLException, InterruptedException {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("deviceName", "msm8953_64");
        capabilities.setCapability("automationName", "Appium");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("platformVersion", "6.0");
        capabilities.setCapability("appPackage", "com.android.calculator2");
        capabilities.setCapability("appActivity", ".Calculator");
        driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
        driver.findElementByAndroidUIAutomator("text(\"1\")").click();
        driver.findElementByAndroidUIAutomator("text(\"+\")").click();
        driver.findElementByAndroidUIAutomator("text(\"6\")").click();
        driver.findElementByAndroidUIAutomator("text(\"=\")").click();
        Thread.sleep(2000);
        String result = driver.findElement(By.id("com.android.calculator2:id/result")).getText();
        System.out.println(result);
        driver.quit();
    }
}

pom.xml (java‑client dependency)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.test1.cn</groupId>
  <artifactId>testC</artifactId>
  <version>1.0-SNAPSHOT</version>
  <dependencies>
    <dependency>
      <groupId>io.appium</groupId>
      <artifactId>java-client</artifactId>
      <version>3.2.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

Element Locating Strategies

Key DesiredCapabilities used in the examples:

deviceName : real device or emulator name

automationName : Appium (default) or Selendroid

platformName : Android, iOS, etc.

platformVersion : OS version, e.g., 6.0

appPackage and appActivity : target app identifiers

1. By ID

driver.findElement(By.id("com.android.calculator2:id/digit_9"));

2. By Class Name

driver.findElement(By.className("android.widget.Button"));

3. By XPath

driver.findElement(By.xpath("//android.widget.FrameLayout/android.widget.Button"));

4. By Accessibility ID

driver.findElementByAccessibilityId("加").click();

5. By Android UIAutomator

driver.findElementByAndroidUIAutomator("new UiSelector().text(\"+\")").click();

Using Appium Desktop Inspector

Open the inspector (magnifier icon) after the server is running, connect to the device, and you can view element attributes such as resource‑id, class, content‑desc, etc. The inspector shows both ID and XPath for each element.

Inspector view
Inspector view

Recording Test Scripts with Appium Desktop

1. Click “Start Recording” after launching the server. 2. Interact with the app; the tool records actions as coordinate‑based commands. 3. Choose the target language (e.g., Java‑JUnit) and generate the script.

Recording UI
Recording UI

Sample Recorded Java Test

import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;

public class SampleTest {
    private AndroidDriver driver;

    @Before
    public void setUp() throws MalformedURLException {
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability("automationName", "Appium");
        caps.setCapability("platformName", "Android");
        caps.setCapability("platformVersion", "6.0");
        caps.setCapability("appPackage", "com.android.calculator2");
        caps.setCapability("appActivity", ".Calculator");
        caps.setCapability("deviceName", "msm8953_64");
        driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), caps);
    }

    @Test
    public void sampleTest() {
        (new TouchAction(driver)).tap(429, 574).perform();
        (new TouchAction(driver)).tap(596, 691).perform();
        (new TouchAction(driver)).tap(424, 572).perform();
        (new TouchAction(driver)).tap(418, 1067).perform();
    }

    @After
    public void tearDown() {
        driver.quit();
    }
}

Note: Recorded scripts use absolute coordinates, which are not reliable across devices; they are useful for quick prototyping but should be replaced with robust locators for production tests.

JavaappiumMobile AutomationElement LocatingAppium Desktop
Software Development Quality
Written by

Software Development Quality

Discussions on software development quality, R&D efficiency, high availability, technical quality, quality systems, assurance, architecture design, tool platforms, test development, continuous delivery, continuous testing, etc. Contact me with any article questions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.