Page tree
Skip to end of metadata
Go to start of metadata

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

Version Compatibility

Appium Studio 10.5 and it's java client is compatible with Appium 4.1.2 java client and requires Java 8 JRE Running.

Step 1:  Add SeeTest Appium Drivers dependencies


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'
}


  • Option #2: add jars from the path after installing Appium-Studio

Import all the JARS from <Appium Studio Installation Folder>\clients\appium\java\*.jar and add to your JAVA build path.


Migrating Code (Java)

There are only 3 required steps:

1) Copy the code from Appium Studio

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

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

In Appium Studio, click on File and then Agent Properties. Choose the port and 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();
    }
}
  • No labels