Last active
August 29, 2015 14:27
-
-
Save y3rsh/b3ce9969bfb4ff960d91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Highlight an element for a time | |
/// Useful in debugging/demos | |
/// </summary> | |
/// <param name="element">the element to highlight</param> | |
/// <param name="time">time to highlight before returning to normal</param> | |
public static void HighlightElement(IWebElement element, int highlightTimeMilliseconds = 5000) | |
{ | |
IJavaScriptExecutor js = TestRunner.Driver as IJavaScriptExecutor; | |
String oldStyle = element.GetAttribute("style"); | |
String args = "arguments[0].setAttribute('style', arguments[1]);"; | |
js.ExecuteScript(args, element, "border: 4px solid yellow;display:block;"); | |
Thread.Sleep(highlightTimeMilliseconds); | |
js.ExecuteScript(args, element, oldStyle); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment