mercredi 18 septembre 2019

Have application "wait" until condition changes, Java

I am wondering how to properly use the wait() method in Java to wait until the value of a string changes. I have a string variable called 'CompletedOrder' set to the value of a web element, and if it is equal to "Active" I want the program to wait until it changes. When I run the code below, I just get a notification of the program failing and nothing more. I am properly assigning the string "Active" to the CompletedOrder variable, so I know that's not the issue. Would love some advice on how to properly code this solution

    String CompletedOrder = Catalog.OrderCompleted(driver).getText();

    if (CompletedOrder.contentEquals("Active")) {
        wait();
    }

    else {
        System.out.println("Print something here");
    }

Aucun commentaire:

Enregistrer un commentaire