public static void HighLight(this WebDriver driver, WebElement element)
    {
        var colorBefore = element.GetCssValue("background-color");

        ((IJavaScriptExecutor)driver.WrappedDriver).ExecuteScript("arguments[0].style.backgroundColor = 'green';", element.WrappedElement);
        Thread.Sleep(500);
        ((IJavaScriptExecutor)driver.WrappedDriver).ExecuteScript($"arguments[0].style.backgroundColor = '{colorBefore}';", element.WrappedElement);
    }
Beispiel #2
0
        /// <summary>
        /// Get the CSS value for the requested element by property name.
        /// Note: This requires first locating an element and then calling this.
        /// </summary>
        /// <param name="cssValue">CSS value for the requested element.</param>
        /// <returns></returns>
        public string GetCssValue(string cssValue)
        {
            if (WebElement != null)
            {
                return(WebElement.GetCssValue(cssValue));
            }
            else
            {
                LogManager.Error($"Unable to find the CSS value {cssValue} for the requested element");

                return(string.Empty);
            }
        }
Beispiel #3
0
 /// <summary>
 ///   Get the value of a style property for the first element in the set of matched elements.
 ///   <para> Source: http://api.jquery.com/css/#css1 </para>
 /// </summary>
 /// <param name="cssProperty"> A CSS property. </param>
 /// <returns> String containing the CSS property value. </returns>
 public string Css(string cssProperty)
 {
     return(WebElement.GetCssValue(cssProperty));
 }
Beispiel #4
0
 public void AssertBlueBackGroundFor(WebElement selectableElement)
 {
     Assert.AreEqual("rgba(0, 123, 255, 1)", selectableElement.GetCssValue("background-color"));
 }
 public void Assert_DroppableMenuTestAcceptTabWhen_Moved_NonAcceptableBoxNOColorChange(WebElement element)
 {
     Assert.AreNotEqual("rgba(73, 80, 87, 1)", element.GetCssValue("color"));
 }
 public void Assert_DroppableMenuTestAcceptTab_When_Moved_Accept_Box(WebElement element)
 {
     Assert.AreNotEqual("rgb(70, 130, 180)", element.GetCssValue("color"));
 }
 string IWebElement.GetCssValue(string propertyName)
 {
     return(WebElement.GetCssValue(propertyName));
 }
        /// <summary>
        /// This method will wait until css class value is not null.
        /// If you don't want to wait set default param retries value to 1.
        /// </summary>
        /// <param name="element"></param>
        /// <param name="cssName">Name of css class you are looking for.</param>
        /// <param name="retries">Default value is 0, that means it will use your application settings values for retries.</param>
        /// <returns></returns>

        public static string WaitForCssValue(this WebElement element, string cssName, int retries = 0)
        => WaitForCondition(() => element.GetCssValue(cssName), e => e.Length == 0, retries);