Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

1
I want to click a button using Javascript in Selenium webdriver

Solved 1 Answers 89 Views Selenium
1 1
I am using Selenium Webdriver for automation. I would like to know code to execute Javascript and click on an element.

1 Answer

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

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.
...