RE: How to write JavascriptExecutor.excuteScript()method to highlight an element

Answered

driver.get(“http://www.facebook.com”);

JavascriptExecutor js=(JavascriptExecutor)driver;

WebElement username= driver.findElement(By.id(“email”));

I want to understand below line….

js.executeScript(“arguments[0].setAttribute(‘style’, arguments[1]);”, username, “color: orange; border: 4px solid orange;”);

snpanigrahi9 Train Asked on November 19, 2014 in Selenium WebDriver.
Add Comment
1 Answers
Best answer

Hi,

Try the below tutorial, it might throw some light.

http://www.toolsqa.com/selenium-webdriver/javascript-tricks-using-selenium/

Regards,
Lakshay Sharma

Professor Answered on November 20, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.