power_settings_new
I am using Selenium Webdriver for automation. I would like to know code to execute Javascript and click on an element.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by (171 points)
selected by
0 votes
 
Best answer
WebElement element = driver.findElement(/*Your find element By*/);
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
add
...