I am attempting to write a while loop that checks the `isDisplayed()` attribute against a loading element, and prints "it is loading" if the loading window is visible. If the loading window disappears, the while loop will exit.

```
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, and the cycle is interrupted.