Subscribe Us

How to Click on Check Box in Selenium WebDriver

.
Question : How to Click on Check Box in Selenium WebDriver Using Java ?

Answer :
To click on check box we use click() method .

Step-1 First inspect the Check box
Step-2 Now Locate the element with locator .
Step-3 Execute the Code.

Click() method 
Click method in selenium used to perform various mouse based operation.In selenium click method is use for various purpose some of them listed below
- Selecting the radio button
- Clicking on Check box
- Clicking on Link 
- Clicking on radio button
- Mouse Drag and Drop
- Click and Hold etc.

Example
example of click method is given below. 
driver.findElement(By.id("vfb-6-0")).click();

Selenium Code to Click on Check box Using Java

Code:
package automation;

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

public class ClickMethod
{
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver", "C:\\Software\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.navigate().to("http://demo.guru99.com/test/radio.html");
driver.findElement(By.id("vfb-6-0")).click();
}
}


In this tutorial we learn how to Click on Check box in selenium webdriver with various types .Hope this tutorial helpful for you 😊

Thanks & Regards 
Sandeep Yadav

Related Post :

  • How to uncheck the checkbox in selenium webdriver
  • How to Select radio button in selenium webdriver 
  • How to unselect the radio button in selenium webdriver 
  • How select mutliple value from the dropdown in selenium webdrver


Important Tags :
How to Click on checkbox in Selenium , how to click checkbox in Selenium webdriver using java , how to click check box in selenium webdriver 
How to Click on Check Box in Selenium WebDriver 




Post a Comment

0 Comments