top of page

Appium Tutorial

Create First Appium Test

How To Create First Test Using Appium ?

To create a test in appium, follow these steps :
Create a Maven Project.
Add dependencies in pom.xml :

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">








































Create a package in src/test/java as 'appiumexamples'.
Create a testng class within this package.

To inspect a web element :
  • Launch the emulator.

  • Go to the desired mobile page.

  • Now, start Appium Server.

  • Click on Search icon.

  • It will open a session window.

  • Add Desired capabilites as shown in the image :

​ ​ ​ ​ ​ ​

  • Start session.

  • A window will be opened that contains the mobile screen view of the emulator.

  • Right-click on this mobile screen view and click on Inspect Element.

  • Locate the webelement.

To know the udid of device :
  • Run command 'adb devices' on command prompt.

  • It will show a list of attached emulator.

  • The integers written next to emulator is its udid.

Add below lines of code in testng class :

package appiumexamples; import org.testng.annotations.Test; import io.appium.java_client.MobileElement; import; import org.testng.annotations.BeforeClass; import; import; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import; import org.testng.annotations.AfterClass; ​ public class FirstAppiumTest { AndroidDriver<MobileElement> driver; @FindBy(xpath = "//*[@text='AUTHENTICATE']") WebElement authenticationButton; ​ @Test public void firstAppiumTest() {; driver.findElementByAccessibilityId("Start").click(); } ​ @BeforeClass public void startSession() throws MalformedURLException { DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability("deviceName", "Pixel 3 API 28"); // device Name caps.setCapability("udid", 5554); // DeviceId from "adb devices" command caps.setCapability("platformName", "Android"); caps.setCapability("skipUnlock", "true"); caps.setCapability("app","C:\\Users\\Dell\\appiumProject\\AndroidAppium\\src\\main\\resources\\apk\\cleardil_sdk_android_example_1.0.0.apk");caps.setCapability("noReset", "false"); driver = new AndroidDriver<MobileElement>(new URL(""), caps); } ​ @AfterClass public void closeSession() { driver.closeApp(); } }

Launch the emulator.
Start the Appium Server.
Run as 'TestNG Test'.

bottom of page