예제 #1
0
        /// <summary>
        ///     Waits, until the <see cref="IWebElement" /> has become not Clickable(Displayed and Enabled).
        ///     <para>
        ///         Exceptions ignored until timeout: <see cref="NoSuchElementException" />,
        ///         <see cref="StaleElementReferenceException" />
        ///     </para>
        /// </summary>
        /// <param name="wait">The <see cref="WebDriverWait" /> instance, that is used to command the browser for wait.</param>
        /// <param name="locator">
        ///     <inheritdoc cref="ISearchContext.FindElement(By)" />
        /// </param>
        /// <exception cref="WebDriverTimeoutException"></exception>
        /// <exception cref="NoSuchElementException"></exception>
        /// <exception cref="StaleElementReferenceException"></exception>
        public static bool UntilElementIsNotClickable([NotNull] this WebDriverWait wait, [NotNull] By locator)
        {
            if (wait == null)
            {
                throw new ArgumentNullException(nameof(wait));
            }
            if (locator == null)
            {
                throw new ArgumentNullException(nameof(locator));
            }

            wait.IgnoreExceptionTypes(typeof(NoSuchElementException), typeof(StaleElementReferenceException));
            wait.Message += " Waited for " +
                            $"({locator} in the Document) element " +
                            "to become not Clickable(Displayed and Enabled).";

            return(wait.Until(WebDriverWaitConditions.ElementToBecomeNotClickable(locator)));
        }