Can someone please help!
How can I highlight all web elements in following class during test execution in WebDriver? With Selenium RC, it was quite straight forward
JavaScript : Find Xpath of an element and Draw Border around it,
using styleObj.setProperty(CSS propertyName, CSS propertyValue, priority) method.
element_node.style.setProperty ("background-color", "green", null);
test js-code on this site : https://developer.chrome.com/devtools/docs/console
var xpath = '//html/body/div/main/article/nav';
if (document.evaluate){
var element_node = document.evaluate(xpath, window.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue;
element_node.style.setProperty ('border', '3px solid green', 'important');
alert('Working Fine in this browser version');
}else{
alert('document.evaluate is Not supported by Internet Explorer');
}
Selenium
public static void drawBorder(WebDriver driver, String xpath){
WebElement element_node = driver.findElement(By.xpath(xpath));
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("arguments[0].style.border='3px solid red'", element_node);
}