docs: public static ExpectedCondition<Boolean> invisibilityOfElementWithText(final By locator,
                                                                           final String text) {
      return new ExpectedCondition<Boolean>() {
        @Override
        public Boolean apply(WebDriver driver) {
          try {
            return !driver.findElement(locator).getText().equals(text);
          } catch (NoSuchElementException e) {
            // Returns true because the element with text is not present in DOM. The
            // try block checks if the element is present but is invisible.
            return true;
          } catch (StaleElementReferenceException e) {
            // Returns true because stale element reference implies that element
            // is no longer visible.
            return true;
          }
        }
  
  
        @Override
        public String toString() {
          return String.format("element containing '%s' to no longer be visible: %s",
                               text, locator);
        }
      };
    }