예제 #1
0
        /// <summary>
        ///     Waits, until the browser's loaded Url should meet the given condition.
        /// </summary>
        /// <param name="wait">The <see cref="WebDriverWait" /> instance, that is used to command the browser for wait.</param>
        /// <param name="condition">The <see cref="Func{T,TResult}" />, that defines the condition until the browser must wait.</param>
        /// <exception cref="WebDriverTimeoutException"></exception>
        public static TResult UntilUrl <TResult>(
            [NotNull] this WebDriverWait wait,
            [NotNull] Func <Uri, TResult> condition)
        {
            if (wait == null)
            {
                throw new ArgumentNullException(nameof(wait));
            }
            if (condition == null)
            {
                throw new ArgumentNullException(nameof(condition));
            }

            wait.Message += " Waited for " +
                            "loaded url " +
                            "to meet the given condition.";

            return(wait.Until(WebDriverWaitConditions.Url(condition)));
        }