Road to setup and create first Appium Webdriver android script in Java

About Appium:
Appium is open source automation tool for iOS and android application supported by Sauce Lab. It is cross platform, supported Native, Hybrid iOS and android application. At backend it uses webdriver JSON wire protocol to communicate with iOS and android applications.
Appium supported many languages like Webdriver. You can write your test scripts any language that has selenium client library.
Appium support UIAutomator framework for ios and android library (For newer Api) and use selendroid for older android platform.
In this post I will show you how to setup and create Appium android script in java language.

Prerequisite:
1. JDK should be installed and java home path setup in your machine.
2. Android SDK should be installed on your machine and android path should be setup in your machine
3. Appium for window download from: download
4. Selenium jar file from: download
5. Eclipse.

Steps to create and run android test script:
1. Go to Appium downloaded package unzip and click on “Appium.exe”. Appium server console will be open like below:

2. You can change IP address and port, but keep it as a default.
3. Click on Launch button to run appium server you should see appium server running window like below

4. Launch emulator or connect device to the machine. Run adb command to check device is connected to your machine.
5. Below is sample code of webdriver in java for Appium in TestNg framework.

package com.test;

import java.io.File;
import java.net.URL;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.HasTouchScreen;
import org.openqa.selenium.interactions.TouchScreen;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteTouchScreen;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class AppiumTest {
 
    private WebDriver driver;

    @BeforeMethod
    public void setUp() throws Exception {
     
        // set up appium
        File appDir = new File("{pathApk file}");
        File app = new File(appDir, "{APK file Name}"); //my case “demo1.apk”
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("device","Android");
        capabilities.setCapability(CapabilityType.BROWSER_NAME,  "");
        capabilities.setCapability(CapabilityType.VERSION, "4.2");
        capabilities.setCapability(CapabilityType.PLATFORM, "WINDOW");
        capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("app-package", "{app package name}");  //my case com.gorillalogic.monkeytalk.demo1
        capabilities.setCapability("app-activity", ".{main activity class}");  //my case RootActivity
        driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
       
    }

    @AfterMethod
    public void tearDown() throws Exception { 
        driver.quit();
    }
    
    @Test
    public void loginTest() throws InterruptedException
    {     
     List textFieldsList = driver.findElements(By.className("android.widget.EditText")); 
        int size = textFieldsList.size();

        textFieldsList.get(0).sendKeys("Admin");
        textFieldsList.get(1).sendKeys("Admin");
        driver.findElements(By.xpath("android.widget.Button")).get(1).click();
        WebElement logout = driver.findElement(By.name("LOGOUT"));
        String logOut = logout.getText();
        System.out.println(logOut);
        logout.click();
    }
    
    @Test
    public void formTest() throws InterruptedException
    {     
     List textFieldsList = driver.findElements(By.className("android.widget.RelativeLayout")); 
        textFieldsList.get(2).click();
        
        driver.findElement(By.className("android.widget.Spinner")).click();        
        List listsDropDown = driver.findElements(By.className("android.widget.CheckedTextView")); 
        for(WebElement listdropdown: listsDropDown){
         String list = listdropdown.getText();        
         if(list.equals("Oxygen")){
          listdropdown.click();
         }
        }
        
        //click on check box
        WebElement checkBox = driver.findElement(By.className("android.widget.CheckBox"));        
        if(checkBox.isSelected()){
         checkBox.click();
        }
        
        //radio button 
        driver.findElements(By.className("android.widget.RadioButton")).get(1).click();      
       
    }      
   
}
6. In above example I have taken demo application from monkey talk, you can download from there or chose your application. Appium automatic install application in emulator or devices when run test scripts. Hope this will help for you.

24 comments:

  1. Hi,

    i have tried the following steps which u have mentioned above in your post.But still i cant able to run the file.

    In my scenario i have tested with JUnit framework.


    Code:


    import java.io.File;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.concurrent.TimeUnit;

    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.remote.CapabilityType;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.remote.RemoteWebDriver;
    import org.openqa.selenium.support.ui.ExpectedConditions;
    import org.openqa.selenium.support.ui.WebDriverWait;

    public class androidExample {


    WebDriver driver = null;

    @Before
    public void setup() throws Exception{
    File appDir = new File("D:\\apk\\");
    File app = new File(appDir, "Flipkart.apk");
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    capabilities.setCapability("device","Android");
    //capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
    capabilities.setCapability("device ID", "emulator-5554");
    capabilities.setCapability(CapabilityType.VERSION, "4.2.2");
    capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
    capabilities.setCapability("app", app.getAbsolutePath()); //app.getAbsolutePath()
    // Here we mention the app's package name, to find the package name we have to convert .apk file into java class files
    capabilities.setCapability("app-package","com.flipkart.android");
    //Here we mention the activity name, which is invoked initially as app's first page.
    capabilities.setCapability("app-activity","LoginActivity");
    //capabilities.setCapability("app-wait-activity","LoginActivity,NewAccountActivity");
    driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);

    }

    @Test
    public void loginTest() throws Exception
    {
    System.out.println("Inside Test Function");
    driver.findElement(By.xpath("//EditText[@text='Email Address']")).sendKeys("tester@gmail.com");
    driver.findElement(By.xpath("//LinearLayout/EditText[2]")).sendKeys("Testerpwd");
    driver.findElement(By.xpath("//CheckBox")).click();
    driver.findElement(By.xpath("//Button[@text='Login']")).click();

    WebDriverWait wait = new WebDriverWait(driver,80);
    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//Button[@text='Logout']")));
    driver.findElement(By.xpath("//Button[@text='Logout']")).click();

    }

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

    }


    ------------------------------------------------------------------------------------------------------------------------------
    Error which was shown in my console:
    Error :org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
    Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
    System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_51'
    Driver info: driver.version: RemoteWebDriver

    ReplyDelete
    Replies
    1. 1) Stop appium server
      2) adb kill-server and adb start-server
      3) adb devices
      4) Start appium server
      5) Run the script, still same error observed.
      6) as you mentioned 4723 kindly verify same as appium server.
      7) Still not resolved the problem

      8) traverse to installed path in appium windows->c:\programfiles(x86)\appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\build\lib
      9) edit chromedriver.js
      10) Change return-regenerator.awrap((0,-asyncbox.retryInterval)(4, 200). change 100 instead of 4. and save it.

      11) Run the script.. hope its working for me...

      Delete
  2. Hi,

    i have tried the following steps which u have mentioned above in your post.But still i cant able to run the file.

    In my scenario i have tested with JUnit framework.


    Code:


    import java.io.File;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.concurrent.TimeUnit;

    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.remote.CapabilityType;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.remote.RemoteWebDriver;
    import org.openqa.selenium.support.ui.ExpectedConditions;
    import org.openqa.selenium.support.ui.WebDriverWait;

    public class androidExample {


    WebDriver driver = null;

    @Before
    public void setup() throws Exception{
    File appDir = new File("D:\\apk\\");
    File app = new File(appDir, "Flipkart.apk");
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    capabilities.setCapability("device","Android");
    //capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
    capabilities.setCapability("device ID", "emulator-5554");
    capabilities.setCapability(CapabilityType.VERSION, "4.2.2");
    capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
    capabilities.setCapability("app", app.getAbsolutePath()); //app.getAbsolutePath()
    // Here we mention the app's package name, to find the package name we have to convert .apk file into java class files
    capabilities.setCapability("app-package","com.flipkart.android");
    //Here we mention the activity name, which is invoked initially as app's first page.
    capabilities.setCapability("app-activity","LoginActivity");
    //capabilities.setCapability("app-wait-activity","LoginActivity,NewAccountActivity");
    driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);

    }

    @Test
    public void loginTest() throws Exception
    {
    System.out.println("Inside Test Function");
    driver.findElement(By.xpath("//EditText[@text='Email Address']")).sendKeys("tester@gmail.com");
    driver.findElement(By.xpath("//LinearLayout/EditText[2]")).sendKeys("Testerpwd");
    driver.findElement(By.xpath("//CheckBox")).click();
    driver.findElement(By.xpath("//Button[@text='Login']")).click();

    WebDriverWait wait = new WebDriverWait(driver,80);
    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//Button[@text='Logout']")));
    driver.findElement(By.xpath("//Button[@text='Logout']")).click();

    }

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

    }


    ------------------------------------------------------------------------------------------------------------------------------
    Error which was shown in my console:
    Error :org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
    Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
    System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_51'
    Driver info: driver.version: RemoteWebDriver

    ReplyDelete
    Replies
    1. add single . before main activity class as below:

      capabilities.setCapability("app-activity",".LoginActivity");

      Also make sure your Appium server host url is same with configured in script

      Delete
  3. First of all I would like to thanks you for this article. I have gone through each steps and executed test.

    ReplyDelete
  4. what if my device is connected to remote machine and i have to execute script from my machine? will it work? if not what will be the reason>

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Hi, I have following questions.
    1.Which line of code should modify to choose demo application from monkey talk.
    2.I hit this url "http://127.0.0.1:4723/wd/hub" in website. I got this message "That URL did not map to a valid JSONWP resource"

    I don't know where i went wrong. Kindly reply ASAP

    ReplyDelete
    Replies
    1. HI manivannan,

      Are you looking sample demo.apk file, If yes I have downloaded this from monkeytalk package.You can try from your apk file, but if you are looking for same then download from monkeytalk ide you will get sample application from there.

      Thanks,
      Admin

      Delete
  7. Hi ,
    I am doing ioS Mobile automation testing for Native application.
    Can anyone tell me when to use CapabilityType.SUPPORT_ALERTS while setting the capabilities for driver object .And what parameters does it take.

    ReplyDelete
  8. Hi,
    I have doubt in this line
    driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    What URL we need to give here..Could you explain please.

    ReplyDelete
    Replies
    1. This is default url of appium server, Check your appium server address, Also check your appium server is running in same machine or not

      Delete
  9. Hi
    i am using appium 1.2.3.1 and using monkey talk apk to run the test.
    But while running the test script, i got error message.
    Console:

    FAILED CONFIGURATION: @BeforeMethod setUp
    org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: platformName, deviceName) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 274 milliseconds
    Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30'
    System info: host: 'TestingServer', ip: '192.168.1.150', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_17'
    Driver info: org.openqa.selenium.remote.RemoteWebDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)


    Appium Server :
    > info: [37m--> [39m [37mPOST [39m [37m/wd/hub/session [39m [90m{"desiredCapabilities":{"platform":"WINDOW","app":"D:\\Apk\\com.gorillalogic.monkeytalk.demo1.apk","browserName":"","app-package":"com.gorillalogic.monkeytalk.demo1","device":"Android","app-activity":".RootActivity","version":"4.4"}} [39m
    > error: The following desired capabilities are required, but were not provided: platformName, deviceName
    > info: [debug] Got configuration error, not starting session
    > info: [debug] Cleaning up appium session
    > info: [debug] Error: The following desired capabilities are required, but were not provided: platformName, deviceName
    > at Capabilities.checkValidity (E:\Appium\node_modules\appium\lib\server\capabilities.js:139:13)
    > at Appium.configure (E:\Appium\node_modules\appium\lib\appium.js:261:35)
    > at Appium.start (E:\Appium\node_modules\appium\lib\appium.js:105:10)
    > error: Failed to start an Appium session, err was: Error: The following desired capabilities are required, but were not provided: platformName, deviceName
    > at Object.exports.createSession [as handle] (E:\Appium\node_modules\appium\lib\server\controller.js:179:16)
    > at next_layer (E:\Appium\node_modules\appium\node_modules\express\lib\router\route.js:113:13)
    > at Route.dispatch (E:\Appium\node_modules\appium\node_modules\express\lib\router\route.js:117:5)
    > at E:\Appium\node_modules\appium\node_modules\express\lib\router\index.js:222:24
    > at Function.proto.process_params (E:\Appium\node_modules\appium\node_modules\express\lib\router\index.js:288:12)
    > at next (E:\Appium\node_modules\appium\node_modules\express\lib\router\index.js:216:19)
    > at next (E:\Appium\node_modules\appium\node_modules\express\lib\router\index.js:180:38)
    > info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: platformName, deviceName)","origValue":"The following desired capabilities are required, but were not provided: platformName, deviceName"},"sessionId":null}
    > info: [37m<-- POST /wd/hub/session [39m [31m500 [39m [90m 15.380 ms - 314 [39m [90m [39m

    Am trying on last 2 weeks . Please reply ASAP.

    ReplyDelete

  10. I want to press done button in android key board please can anyone help me. i am using selenium webdriver and Appium. 

    ReplyDelete
  11. Hi,
    i am installed all files, but am unable to run the script..
    below are the error..
    Starting Node Server
    > usage: main.js [-h] [-v] [--shell] [--app APP] [--ipa IPA] [-q] [-U UDID]
    > [-a ADDRESS] [-p PORT] [-bp BOOTSTRAPPORT] [-k]
    > [-r BACKENDRETRIES] [--session-override] [--full-reset]
    > [--no-reset] [-l] [-lt LAUNCHTIMEOUT] [-g LOG]
    > [--log-timestamp] [--log-no-colors] [-G WEBHOOK]
    > [--native-instruments-lib] [--force-quit-instruments]
    > [--app-pkg ANDROIDPACKAGE] [--app-activity ANDROIDACTIVITY]
    > [--app-wait-package ANDROIDWAITPACKAGE]
    > [--app-wait-activity ANDROIDWAITACTIVITY]
    > [--android-coverage ANDROIDCOVERAGE] [--avd AVD]
    > [--avd-args AVDARGS]
    > [--device-ready-timeout ANDROIDDEVICEREADYTIMEOUT] [--safari]
    > [--device-name DEVICENAME] [--platform-name PLATFORMNAME]
    > [--platform-version PLATFORMVERSION]
    > [--automation-name AUTOMATIONNAME] [--browser-name BROWSERNAME]
    > [--default-device] [--force-iphone] [--force-ipad]
    > [--language LANGUAGE] [--locale LOCALE]
    > [--calendar-format CALENDARFORMAT] [--orientation ORIENTATION]
    > [--tracetemplate AUTOMATIONTRACETEMPLATEPATH] [--show-sim-log]
    > [--nodeconfig NODECONFIG] [-ra ROBOTADDRESS] [-rp ROBOTPORT]
    > [--selendroid-port SELENDROIDPORT]
    > [--chromedriver-port CHROMEDRIVERPORT] [--use-keystore]
    > [--keystore-path KEYSTOREPATH]
    > [--keystore-password KEYSTOREPASSWORD] [--key-alias KEYALIAS]
    > [--key-password KEYPASSWORD] [--show-config]
    > [--command-timeout DEFAULTCOMMANDTIMEOUT] [--keep-keychains]
    >
    >
    > ERROR:
    > Node Server Process Ended

    ReplyDelete
  12. I am unable to resolve the error please help me

    FAILED CONFIGURATION: @BeforeMethod setUp
    java.lang.IllegalArgumentException: No enum constant org.openqa.selenium.Platform.WINDOWS 7
    at java.lang.Enum.valueOf(Unknown Source)
    at org.openqa.selenium.Platform.valueOf(Platform.java:1)
    at org.openqa.selenium.remote.DesiredCapabilities.setCapability(DesiredCapabilities.java:168)
    at test.java.com.saucelabs.appium.login.setUp(login.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

    SKIPPED CONFIGURATION: @AfterMethod tearDown
    SKIPPED CONFIGURATION: @BeforeMethod setUp
    SKIPPED CONFIGURATION: @AfterMethod tearDown
    SKIPPED: formTest
    SKIPPED: loginTest

    ===============================================
    Default test
    Tests run: 2, Failures: 0, Skips: 2
    Configuration Failures: 1, Skips: 3
    ===============================================


    ===============================================
    Default suite
    Total tests run: 2, Failures: 0, Skips: 2
    Configuration Failures: 1, Skips: 3
    ===============================================

    [TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@7fbcac12: 89 ms
    [TestNG] Time taken by org.testng.reporters.XMLReporter@66e136be: 12 ms
    [TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 13 ms
    [TestNG] Time taken by org.testng.reporters.EmailableReporter2@2004916b: 9 ms
    [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@5043cc83: 15 ms
    [TestNG] Time taken by org.testng.reporters.jq.Main@6eb04214: 42 ms

    ReplyDelete
  13. I'm impersesd by your writing. Are you a professional or just very knowledgeable.Thanku….ALOKA UST-5546

    ReplyDelete

  14. //*************************NPE**************


    [TestNG] Running:
    C:\Users\Administrator\AppData\Local\Temp\testng-eclipse-590914370\testng-customsuite.xml

    .....************* null
    driver == null
    FAILED: loginTest
    java.lang.NullPointerException
    at apptest.TestExp1.loginTest(TestExp1.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)


    ===============================================
    Default test
    Tests run: 1, Failures: 1, Skips: 0
    ===============================================


    ===============================================
    Default suite
    Total tests run: 1, Failures: 1, Skips: 0
    ===============================================

    [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@11d7fff: 10 ms
    [TestNG] Time taken by org.testng.reporters.jq.Main@8239c8: 53 ms
    [TestNG] Time taken by org.testng.reporters.EmailableReporter2@37c6dc: 7 ms
    [TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@8da962: 18 ms
    [TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 6 ms
    [TestNG] Time taken by org.testng.reporters.XMLReporter@1468bd9: 6 ms

    ReplyDelete

  15. //*************************NPE**************


    [TestNG] Running:
    C:\Users\Administrator\AppData\Local\Temp\testng-eclipse-590914370\testng-customsuite.xml

    .....************* null
    driver == null
    FAILED: loginTest
    java.lang.NullPointerException
    at apptest.TestExp1.loginTest(TestExp1.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)


    ===============================================
    Default test
    Tests run: 1, Failures: 1, Skips: 0
    ===============================================


    ===============================================
    Default suite
    Total tests run: 1, Failures: 1, Skips: 0
    ===============================================

    [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@11d7fff: 10 ms
    [TestNG] Time taken by org.testng.reporters.jq.Main@8239c8: 53 ms
    [TestNG] Time taken by org.testng.reporters.EmailableReporter2@37c6dc: 7 ms
    [TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@8da962: 18 ms
    [TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 6 ms
    [TestNG] Time taken by org.testng.reporters.XMLReporter@1468bd9: 6 ms

    ReplyDelete
  16. I am working on automation on a chat application and i want to send/receive messages, is it possible by using Appium? Also Is it possible to pause the Appium while it is running, and is it possible to send a request to web services through Appium scripts? please suggest

    ReplyDelete
  17. I am working on automation on a chat application and i want to send/receive messages, is it possible by using Appium? Also Is it possible to pause the Appium while it is running, and is it possible to send a request to web services through Appium scripts? please suggest

    ReplyDelete
  18. I am getting the below error when launching the application
    Please help me with the settings.


    > info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: platformName)","origValue":"The following desired capabilities are required, but were not provided: platformName"},"sessionId":null}

    ReplyDelete
  19. This comment has been removed by a blog administrator.

    ReplyDelete
  20. Why whatsapp can't able to run the test scripts in appium....

    ReplyDelete

Leave your comments, queries, suggestion I will try to provide solution