jeudi 31 mai 2018

if-else statements are not working properly for Appium Java script

I have written a Java code with if-else statements and user would move from 'Screen1' to 'Screen2' through any of 4 alternate routes and I have attached an image for all enter image description herepossible application flows which are decided on the go by of course code written by developer. Just to add tool used is Appium.

    driver.findElement(By.id("----")).click(); //this click will take from  'screen1' to next screen.

    if(driver.findElement(By.id("abc")).isDisplayed())//see if element on 'screen A' is displayed
    {
        //execute a few statements

    }

    else if(driver.findElement(By.id("xyz")).isDisplayed()) //see if element on 'Screen B' is displayed
    {

       //execute a few statements

    if(driver.findElement(By.id("abc")).isDisplayed()) //see if element on 'screen A' is displayed

    {
        // execute
    }

    }
 driver.findElement(By.id("----")); //this is code for 'Screen 2'

What happens is during execution of script, first 'If' is checked and rest all code skipped. I am not able to figure out the issue. Please help.

Aucun commentaire:

Enregistrer un commentaire