FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 158   



The following java program starts appium and loads the given app app-debug.apk

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;

public class AndroidAppiumHelloWorld {
    private static AppiumDriver<WebElement> driver;

    public static void main(String[] args) throws MalformedURLException, InterruptedException {
        File appDir = new File("/path/to/directory");
        File app = new File(appDir, "app-debug.apk");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("deviceName", "Nexus_6P_API_23");
        capabilities.setCapability("platformVersion", "6.0");
        capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("appPackage", "com.testapp");
        capabilities.setCapability("appActivity", ".MainActivity");
        driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

        Thread.sleep(10 * 60 * 1000);
    }
}



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News