lib/WebDriverExpectedCondition.php
public static function invisibilityOfElementWithText(WebDriverBy $by, $text)
    {
        return new static(
            function (WebDriver $driver) use ($by, $text) {
                try {
                    return !($driver->findElement($by)->getText() === $text);
                } catch (NoSuchElementException $e) {
                    return true;
                } catch (StaleElementReferenceException $e) {
                    return true;
                }
            }
        );
    }
public static function invisibilityOfElementWithText(WebDriverBy $by, $text)
    {
        return new static(
            function (WebDriver $driver) use ($by, $text) {
                try {
                    return !($driver->findElement($by)->getText() === $text);
                } catch (NoSuchElementException $e) {
                    return true;
                } catch (StaleElementReferenceException $e) {
                    return true;
                }
            }
        );
    }
public static function invisibilityOfElementWithText ( WebDriverBy $ by , $ text ) { return new static ( function ( WebDriver $ driver ) use ( $ by , $ text ) { try { return ! ( $ driver -> findElement ( $ by ) -> getText ( ) === $ text ) ; } catch ( NoSuchElementException $ e ) { return true ; } catch ( StaleElementReferenceException $ e ) { return true ; } } ) ; }
An expectation for checking that an element with text is either invisible or not present on the DOM.

@param WebDriverBy $by The locator used to find the element.
@param string $text The text of the element.
@return static Condition returns whether the text is found in the element located.
An expectation for checking that an element with text is either invisible or not present on the DOM .