Skip to main content

AS - Run Your Existing Appium Tests

info

Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .

This document describes the necessary steps for migrating a code written with the standard Java Appium client API.

Version Compatibility

tip

Appium Studio 10.5 and it's java client are compatible with Appium 4.1.2 java client and require the Java 8 JRE.

  1. Add the SeeTest Appium Drivers dependencies. You can do this in one of these ways:

build.gradle

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'

repositories {

maven { url "https://cloud.experitest.com/repo" }
maven { url "https://repo.maven.apache.org/maven2" }
mavenCentral()
}
dependencies {
compile group: 'com.experitest', name: 'appium', version:'4.1.2'
}
  1.  Import all the Jar files from <Appium Studio Installation Folder>\clients\appium\java\*.jar and add them to your JAVA build path.

  2. Copy the code from Appium Studio.

  3. Close the Appium Server (if one is running on your machine).

  4. In Appium Studio, make sure that the agent is running on port 4723 (this is the default port, you can always choose another).

  5. Click File → Agent Properties

  6. Choose the port, then run the agent:

Example (Java) - Migrating a test which uses the Android Driver

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

public class Login {
private AndroidDriver<WebElement> driver;

@Before
public void setUp() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".LoginActivity");
capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.experitest.ExperiBank");
capabilities.setCapability(MobileCapabilityType.UDID, "ZX1C229MVT");

driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}

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

@Test
public void loginTest() throws Exception {
driver.findElement(By.id("usernameTextField")).sendKeys("company");
driver.findElement(By.id("passwordTextField")).sendKeys("company");
driver.findElement(By.id("loginButton")).click();
}
}