Beispiel #1
0
        /// <summary>
        ///     The <see cref="IWebElement" />'s given style property should meet the given condition.
        /// </summary>
        /// <param name="locator">
        ///     <inheritdoc cref="ISearchContext.FindElement(By)" />
        /// </param>
        /// <param name="stylePropertyName">The style property's name of the <see cref="IWebElement" />.</param>
        /// <param name="condition">The <see cref="Func{T,TResult}" />, that defines the condition until the browser must wait.</param>
        /// <param name="searchContext">The <see cref="ISearchContext" /> within we search for the element.</param>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="NoSuchElementException"></exception>
        /// <exception cref="StaleElementReferenceException"></exception>
        /// <exception cref="WebDriverException"></exception>
        public static Func <IWebDriver, TResult> ElementStyleProperty <TResult>(
            [NotNull] ISearchContext searchContext,
            [NotNull] By locator,
            [NotNull] ElementStylePropertyName stylePropertyName,
            [NotNull] Func <string, TResult> condition)
        {
            if (searchContext == null)
            {
                throw new ArgumentNullException(nameof(searchContext));
            }
            if (locator == null)
            {
                throw new ArgumentNullException(nameof(locator));
            }
            if (stylePropertyName == null)
            {
                throw new ArgumentNullException(nameof(stylePropertyName));
            }
            if (condition == null)
            {
                throw new ArgumentNullException(nameof(condition));
            }

            return(driver => condition(searchContext.FindElement(locator).Style().Get(stylePropertyName)));
        }
Beispiel #2
0
        /// <summary>
        ///     ...Description to be added...
        /// </summary>
        public void Remove([NotNull] ElementStylePropertyName elementStylePropertyName)
        {
            if (elementStylePropertyName == null)
            {
                throw new ArgumentNullException(nameof(elementStylePropertyName));
            }

            Remove(elementStylePropertyName.PropertyName);
        }
Beispiel #3
0
        /// <summary>
        ///     ...Description to be added...
        /// </summary>
        public string GetValue([NotNull] ElementStylePropertyName elementStylePropertyName)
        {
            if (elementStylePropertyName == null)
            {
                throw new ArgumentNullException(nameof(elementStylePropertyName));
            }

            return(Element.GetCssValue(elementStylePropertyName.PropertyName));
        }
Beispiel #4
0
        /// <summary>
        ///     ...Description to be added...
        /// </summary>
        public void Set([NotNull] ElementStylePropertyName elementStylePropertyName,
                        [CanBeNull] object stylePropertyValue)
        {
            if (elementStylePropertyName == null)
            {
                throw new ArgumentNullException(nameof(elementStylePropertyName));
            }

            Set(elementStylePropertyName.PropertyName, stylePropertyValue);
        }
Beispiel #5
0
        /// <summary>
        ///     The <see cref="IWebElement" />'s given style property should meet the given condition.
        /// </summary>
        /// <param name="element">The HTMLElement, that is represented by an <see cref="IWebElement" /> instance.</param>
        /// <param name="stylePropertyName">The style property's name of the <see cref="IWebElement" />.</param>
        /// <param name="condition">The <see cref="Func{T,TResult}" />, that defines the condition until the browser must wait.</param>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="StaleElementReferenceException"></exception>
        /// <exception cref="WebDriverException"></exception>
        public static Func <IWebDriver, TResult> ElementStyleProperty <TResult>(
            [NotNull] IWebElement element,
            [NotNull] ElementStylePropertyName stylePropertyName,
            [NotNull] Func <string, TResult> condition)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }
            if (stylePropertyName == null)
            {
                throw new ArgumentNullException(nameof(stylePropertyName));
            }
            if (condition == null)
            {
                throw new ArgumentNullException(nameof(condition));
            }

            return(driver => condition(element.Style().Get(stylePropertyName)));
        }