Hi i m new to appium.. i am not able to run a script on demo apk file... please help me

Hi i m new to appium… i am trying to run a script on demo apk file… but its showing the following error in the console… please help me…

Thanks in advance… my code is as below

package PACKAGE.test;

import java.net.MalformedURLException;
import java.net.URL;

import java.util.List;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;

public class script1 {

private static WebDriver driver;

public static void main(String[] args) {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("device", "Android");
    capabilities.setCapability(CapabilityType.VERSION, "5.1");
    capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("app-activity", ".RootActivity");
    try {
        driver = new RemoteWebDriver(new URL(""),
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block


public void tearDown() throws Exception {


public void loginTest() throws InterruptedException {

    List<WebElement> textFieldsList = driver.findElements(By
    int size = textFieldsList.size();

    WebElement logout = driver.findElement(By.name("LOGOUT"));
    String logOut = logout.getText();

public void formTest() throws InterruptedException {

    List<WebElement> textFieldsList1 = driver.findElements(By

    List<WebElement> listsDropDown = driver.findElements(By
    for (WebElement listdropdown : listsDropDown) {
        String list = listdropdown.getText();
        if (list.equals("Oxygen")) {

    // click on check box
    WebElement checkBox = driver.findElement(By
    if (checkBox.isSelected()) {

    // radio button



my error is as follows…

When i run my script using android junit test

the emulator opens and i get the following error

[2015-03-09 11:10:17 - com.script.java1] Automatic Target Mode: using existing emulator ‘emulator-5554’ running compatible AVD ‘abc1’
[2015-03-09 11:10:18 - com.script.java1] Application already deployed. No need to reinstall.
[2015-03-09 11:10:18 - com.script.java1] Launching instrumentation android.test.InstrumentationTestRunner on emulator-5554
[2015-03-09 11:10:18 - com.script.java1] Failed to launch test
[2015-03-09 11:11:02 - com.script.java1] ------------------------------
[2015-03-09 11:11:02 - com.script.java1] Android Launch!
[2015-03-09 11:11:02 - com.script.java1] adb is running normally.
[2015-03-09 11:11:02 - com.script.java1] Performing android.test.InstrumentationTestRunner JUnit launch
[2015-03-09 11:11:02 - com.script.java1] Automatic Target Mode: launching new emulator with compatible AVD ‘abc1’
[2015-03-09 11:11:02 - com.script.java1] Launching a new emulator with Virtual Device ‘abc1’
[2015-03-09 11:11:22 - Emulator] emulator: warning: opening audio output failed
[2015-03-09 11:11:22 - Emulator]
[2015-03-09 11:11:22 - com.script.java1] New emulator found: emulator-5554
[2015-03-09 11:11:22 - com.script.java1] Waiting for HOME (‘android.process.acore’) to be launched…
[2015-03-09 11:12:32 - com.script.java1] HOME is up on device ‘emulator-5554’
[2015-03-09 11:12:32 - com.script.java1] Uploading com.script.java1.apk onto device ‘emulator-5554’
[2015-03-09 11:12:33 - com.script.java1] Installing com.script.java1.apk…
[2015-03-09 11:12:56 - com.script.java1] Success!
[2015-03-09 11:12:56 - com.script.java1] Launching instrumentation android.test.InstrumentationTestRunner on emulator-5554
[2015-03-09 11:12:56 - com.script.java1] Failed to launch test


In order for me to understand what happened, I need you to attach your Appium server logs.


  1. You should be using AppiumDriver, not WebDriver, and instantiate either AndroidDriver or IOSDriver, depending on which type of app you’re testing.
  2. Try putting in an implicit wait or explicit wait at the beginning of the test.

Also, as Hassan Radi said, please provide appium logs as they are essential for troubleshooting.


Thankyou:) It solved and running fine now.


Hi Simon,
There is an button next to recent tab… How to click on it?

And how to click on back home and recent tab in android?
Thanks in advance