예제 #1
0
        /// <summary>
        ///     Waits, until the browser's loaded Url should match the regular expression.
        /// </summary>
        /// <param name="wait">The <see cref="WebDriverWait" /> instance, that is used to command the browser for wait.</param>
        /// <param name="regexPattern">The regular expression pattern.</param>
        /// <exception cref="WebDriverTimeoutException"></exception>
        /// <exception cref="ArgumentException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="RegexMatchTimeoutException"></exception>
        public static bool UntilUrlMatches(
            [NotNull] this WebDriverWait wait,
            [NotNull] string regexPattern)

        {
            if (wait == null)
            {
                throw new ArgumentNullException(nameof(wait));
            }
            if (regexPattern == null)
            {
                throw new ArgumentNullException(nameof(regexPattern));
            }

            wait.Message += " Waited for " +
                            "loaded url " +
                            $"to match with the regular expression ({regexPattern}).";

            return(wait.Until(WebDriverWaitConditions.UrlMatches(regexPattern)));
        }