jeudi 7 novembre 2019

how valid the function isDisplayed() with a while in Selenium

I am trying to make a cycle WHILE I am shown on the console a message "it is loading" if the loading window is visible - present, and if the loading window disappears, it will exit the cycle

private By superPoseLoading = By.xpath("//span[@class='loading']");

            while (true) {

                if (driver.findElement(superPoseLoading).isDisplayed() == true) {
                    System.out.println("is loading");

                }else {
                    break;
                }
            }

but even if the if condition is true, the program does not send the message, the cycle is interrupted

Aucun commentaire:

Enregistrer un commentaire