How To Click Button in selenium Webdriver using Java

How to click Button in selenium webdriver using  java


Click();

Using Click Method we click on button in selenium webdriver

Syntax
 driver.findElement(By.id("loginbutton")).click();


Selenium Code for click on button using java 

package automationtesting;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Click 
{
public static void main(String[] args
{
              System.setProperty("webdriver.chrome.driver","D:\\Sandeep\\Soft\\chromedriver.exe");WebDriver driver= new ChromeDriver();
driver.get("https://facebook.com");
driver.findElement(By.id("email")).sendKeys("sandeep@gamil.com");
driver.findElement(By.id("pass")).sendKeys("abc@123");
driver.findElement(By.id("loginbutton")).click();
}
}

Hope!!! The above code for click on button in selenium webdriver helpful for you...
Team 
QA acharya

Tags: how to click button in selenium , how to click on button using selenium webdriver , Click method in Selenium , Selenium Code for click on button 

How To Click Button in selenium Webdriver


Post a Comment

0 Comments