3

I am using selendroid to test android app. Everything works fine till login click/tap. Once I Tap/Click on login button it close my android application and does not returning any error.

My code is given below :

public class androidaut {

public static void main(String[] args) throws Exception{

    try{

     // specify test capabilities (your 'test environment')
    SelendroidCapabilities capa = new SelendroidCapabilities("air.iNMyBabyPaid:1.3.0");     

    // Set device serial to get device
    capa.setSerial("192.168.xx.xx:xxxx");

    // Set device capability for platform version
    capa.setCapability("platformVersion", "17");


    // explicitly state that we use an emulator (an AVD) for test execution rather than a physical device
    capa.setEmulator(false);



    // start a new WebDriver
    WebDriver driver = new SelendroidDriver(capa);
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);


    // Enter user name
    WebElement username = driver.findElement(By.xpath("(//EditText)[1]"));
    username.click();
    username.sendKeys("tester");


    // Enter password
    WebElement pass = driver.findElement(By.xpath("(//EditText)[2]"));
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    pass.click();
    pass.sendKeys("stester#");

    // Get Login element 
    WebElement login = driver.findElement(By.id("llSignIn"));



    // Click on Login button
    if(login.isEnabled())
    {
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        login.click();
        //System.out.println(((RemoteWebDriver) driver).getSessionId());

    }
    else
    {

        System.out.println("Sorry! Your login button is disabled");
    }

    System.out.println(driver.manage().logs());


    }
    catch(Exception E)

    {
        throw E; 

    }

Once click on Login , it goes to catch part and returns :

org.openqa.selenium.WebDriverException: The selendroid server on the device became unreachable.

How can I do successful login in app. and go inside app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.