How to Perform Click on WebElement using Selenium WebDriver and JavaScript | Selenium - Java

Published: 20 March 2021
on channel: CodeWithAvadoot
2,716
25

In this video, we are going to learn two ways to click a web element in selenium using the selenium webdriver click method and javascript click method.

Code snippet :

driver.get("https://www.facebook.com/");

WebElement loginButton = driver.findElement(By.xpath("//*[@name='login']"));

JavascriptExecutor executor = (JavascriptExecutor) driver;

//Selenium WebDriver click() method
loginButton.click();

//JavaScriptExecutor click() method
executor.executeScript("arguments[0].click()", loginButton);


On this page of the site you can watch the video online How to Perform Click on WebElement using Selenium WebDriver and JavaScript | Selenium - Java with a duration of hours minute second in good quality, which was uploaded by the user CodeWithAvadoot 20 March 2021, share the link with friends and acquaintances, this video has already been watched 2,716 times on youtube and it was liked by 25 viewers. Enjoy your viewing!