/// <summary> /// The <see cref="IWebElement" />'s given property should meet the given condition. /// </summary> /// <param name="locator"> /// <inheritdoc cref="ISearchContext.FindElement(By)" /> /// </param> /// <param name="propertyName">The 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> ElementProperty <TResult>( [NotNull] ISearchContext searchContext, [NotNull] By locator, [NotNull] ElementPropertyName propertyName, [NotNull] Func <object, TResult> condition) { if (searchContext == null) { throw new ArgumentNullException(nameof(searchContext)); } if (locator == null) { throw new ArgumentNullException(nameof(locator)); } if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } if (condition == null) { throw new ArgumentNullException(nameof(condition)); } return(driver => condition(searchContext.FindElement(locator).Properties().Get(propertyName))); }
/// <summary> /// Waits, until the <see cref="IWebElement" />'s given property has met the given condition. /// <para>Exceptions ignored until timeout: <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="propertyName">The 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> /// <param name="locator"> /// <inheritdoc cref="ISearchContext.FindElement(By)" /> /// </param> /// <exception cref="WebDriverTimeoutException"></exception> /// <exception cref="StaleElementReferenceException"></exception> public static TResult UntilElementProperty <TResult>([NotNull] this WebDriverWait wait, [NotNull] ISearchContext searchContext, [NotNull] By locator, [NotNull] ElementPropertyName propertyName, [NotNull] Func <object, TResult> condition) { if (wait == null) { throw new ArgumentNullException(nameof(wait)); } if (searchContext == null) { throw new ArgumentNullException(nameof(searchContext)); } if (locator == null) { throw new ArgumentNullException(nameof(locator)); } if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } if (condition == null) { throw new ArgumentNullException(nameof(condition)); } return(wait.UntilElementProperty(searchContext, locator, propertyName.PropertyName, condition)); }
/// <summary> /// Waits, until the <see cref="IWebElement" />'s given style property has met the given condition. /// <para>Exceptions ignored until timeout: <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="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="locator"> /// <inheritdoc cref="ISearchContext.FindElement(By)" /> /// </param> /// <exception cref="WebDriverTimeoutException"></exception> /// <exception cref="StaleElementReferenceException"></exception> public static TResult UntilElementStyleProperty <TResult>( [NotNull] this WebDriverWait wait, [NotNull] By locator, [NotNull] ElementPropertyName stylePropertyName, [NotNull] Func <string, TResult> condition) { if (wait == null) { throw new ArgumentNullException(nameof(wait)); } 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(wait.UntilElementStyleProperty(locator, stylePropertyName.PropertyName, condition)); }
/// <summary> /// The <see cref="IWebElement" />'s given property should meet the given condition. /// </summary> /// <param name="element">The HTMLElement, that is represented by an <see cref="IWebElement" /> instance.</param> /// <param name="propertyName">The 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> ElementProperty <TResult>( [NotNull] IWebElement element, [NotNull] ElementPropertyName propertyName, [NotNull] Func <object, TResult> condition) { if (element == null) { throw new ArgumentNullException(nameof(element)); } if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } if (condition == null) { throw new ArgumentNullException(nameof(condition)); } return(driver => condition(element.Properties().Get(propertyName))); }
/// <summary> /// Waits, until the <see cref="IWebElement" />'s given property has met the given condition. /// <para>Exceptions ignored until timeout: <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="propertyName">The 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="element">The HTMLElement, that is represented by an <see cref="IWebElement" /> instance.</param> /// <exception cref="WebDriverTimeoutException"></exception> /// <exception cref="WebDriverException"></exception> /// <exception cref="StaleElementReferenceException"></exception> public static TResult UntilElementProperty <TResult>([NotNull] this WebDriverWait wait, [NotNull] IWebElement element, [NotNull] ElementPropertyName propertyName, [NotNull] Func <object, TResult> condition) { if (wait == null) { throw new ArgumentNullException(nameof(wait)); } if (element == null) { throw new ArgumentNullException(nameof(element)); } if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } if (condition == null) { throw new ArgumentNullException(nameof(condition)); } return(wait.UntilElementProperty(element, propertyName.PropertyName, condition)); }