public static function elementTextMatches(WebDriverBy $by, $regexp)
    {
        return new static(
            function (WebDriver $driver) use ($by, $regexp) {
                try {
                    return (bool) preg_match($regexp, $driver->findElement($by)->getText());
                } catch (StaleElementReferenceException $e) {
                    return null;
                }
            }
        );
    }