Saturday 2 January 2016

How to Highlight Web Element in Selenium






JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].style.border='2px groove green'", element);

js.executeScript("arguments[0].setAttribute('style', arguments[1]);",element, "color: Red; border: 2px dotted solid green;");




For Red

js.executeScript("arguments[0].style.border='3px groove red'", element);
js.executeScript("arguments[0].style.border=''", element);



For Green


js.executeScript("arguments[0].style.border='3px groove green'", element);
js.executeScript("arguments[0].style.border=''", element);




js.executeScript("arguments[0].setAttribute('style', arguments[1]);",element, "color: red; border: 3px solid red;");



js.executeScript(
"arguments[0].setAttribute('style', arguments[1]);",
element, "");


1 comment:

  1. I appreciate the vulnerability and honesty you bring to your writing – it's refreshing to see someone share their journey so openly! Step into the world of Retro Bowl Unblocked and experience the thrill of victory!

    ReplyDelete