{"id":2759,"date":"2020-04-23T19:25:05","date_gmt":"2020-04-23T13:55:05","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=2759"},"modified":"2025-12-22T06:07:49","modified_gmt":"2025-12-22T11:07:49","slug":"selecting-checkbox-and-radio-button-with-selenium-webdriver","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/selecting-checkbox-and-radio-button-with-selenium-webdriver\/","title":{"rendered":"Selenium WebDriver CheckBox and Radio Button"},"content":{"rendered":"<p>Selenium WebDriver CheckBox and Radio Button handling is one of the most fundamental skills every automation tester must master while working with web applications. Checkboxes and radio buttons are widely used in forms, login pages, booking portals, and user preference settings. Understanding how to identify, select, deselect, and validate their states using Selenium WebDriver helps testers build reliable and robust test scripts. In this tutorial, you will learn practical examples of automating radio buttons and checkboxes using Selenium WebDriver with Java, along with real-world scenarios from popular websites.<\/p>\n<h2><b>Radio Button<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Using the <\/span><b>click()<\/b><span style=\"font-weight: 400;\"> method a radio button can be accessed by clicking on it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Using <\/span><span style=\"font-weight: 400;\">https:\/\/www.facebook.com\/<\/span><span style=\"font-weight: 400;\">, see that radiobutton1.click() toggles on the \u201cFemale\u201d radio button. Radiobutton2.click() toggles on the \u201cMale\u201d radio button leaving the \u201cFemale\u201d unselected.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">[box type=&#8221;success&#8221; align=&#8221;&#8221; class=&#8221;&#8221; width=&#8221;&#8221;]WebElement femaleradiobutton1 = driver.findElement(By.id(\u201c<\/span><span style=\"font-weight: 400;\">u_0_6<\/span><span style=\"font-weight: 400;\">\u201d));<\/span><\/p>\n<p><span style=\"font-weight: 400;\">WebElement maleradiobutton2 = driver.findElement(By.id(\u201c<\/span><span style=\"font-weight: 400;\">u_0_7<\/span><span style=\"font-weight: 400;\">\u201d));<\/span><\/p>\n<p>[\/box]<\/p>\n<p><b>\/\/Female Radio Button1 is selected<\/b><\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\" wp-image-2760 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_23.png\" alt=\"\" width=\"594\" height=\"181\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_23.png 693w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_23-300x91.png 300w\" sizes=\"(max-width: 594px) 100vw, 594px\" \/><\/p>\n<p><b>\/\/Female Radio Button1 is de-selected and Radio Button2 is selected<\/b><\/p>\n<p><img decoding=\"async\" class=\"wp-image-2761 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_24.png\" alt=\"\" width=\"611\" height=\"208\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_24.png 803w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_24-300x102.png 300w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_24-768x261.png 768w\" sizes=\"(max-width: 611px) 100vw, 611px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s create a test case in which we will automate the following scenarios to handle Radio buttons:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Invoke a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Google_Chrome\" rel=\"nofollow noopener\" target=\"_blank\">Google chrome<\/a> browser.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Navigate to the website in which you handle the Radio button.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Radio Button1 is selected (Female) from the facebook website.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Radio Button1(Female) is de-selected and Radio Button2(Male) is selected<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Close the driver.<\/span><\/li>\n<\/ul>\n<h4><em><b>Complete Code:\u00a0<\/b><\/em><\/h4>\n<pre><span style=\"font-weight: 400;\">import org.openqa.selenium.By;<\/span>\n<span style=\"font-weight: 400;\">import org.openqa.selenium.WebDriver;<\/span>\n<span style=\"font-weight: 400;\">import org.openqa.selenium.chrome.ChromeDriver;<\/span>\n\n<span style=\"font-weight: 400;\">public class Radiobutton{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0public static void main(String[] args) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">\/\/ <\/span><span style=\"font-weight: 400;\">set the system property of a chromedriver.exe file to the path.<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.setProperty(\"webdriver.chrome.driver\",\"<\/span><span style=\"font-weight: 400;\"> D:\\\\Drivers\\\\geckodriver.exe<\/span><span style=\"font-weight: 400;\"> \");<\/span>\n\n<span style=\"font-weight: 400;\">\/\/ Launch the Google Chrome browser.<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WebDriver driver = new ChromeDriver();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0driver.get(\"<\/span><span style=\"font-weight: 400;\">https:\/\/www.facebook.com\/<\/span><span style=\"font-weight: 400;\">\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WebElement femaleradiobutton1 = driver.findElement(By.id(\u201c<\/span><span style=\"font-weight: 400;\">u_0_6<\/span><span style=\"font-weight: 400;\">\u201d));<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WebElement maleradiobutton2 = driver.findElement(By.id(\u201c<\/span><span style=\"font-weight: 400;\">u_0_7<\/span><span style=\"font-weight: 400;\">\u201d));<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Radio Button1 is selected<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0femaleradiobutton1.click();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(\"Female Radio Button is Selected\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Female Radio Button1 is de-selected and Male Radio Button2 is selected<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0maleradiobutton2.click();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(\"Male Radio Button is Selected\");<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\">driver.close();<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h2><b>Check Box<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Checking and Un-Checking a check box on\/off is done using the click() method.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The below code will click on Yahoo \u201cStay signed in\u201d check box two times and display the output as TRUE when it is clicked on, and FALSE if it is Unchecked.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 1:<\/strong> Go to the site <\/span><a href=\"https:\/\/login.yahoo.com\/config\/login?\" rel=\"nofollow noopener\" target=\"_blank\"><span style=\"font-weight: 400;\">https:\/\/login.yahoo.com\/config\/login?<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 2:<\/strong> Click on Sign in button<\/span><\/p>\n<p><img decoding=\"async\" class=\"wp-image-2762 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_25.png\" alt=\"\" width=\"569\" height=\"81\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_25.png 737w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_25-300x43.png 300w\" sizes=\"(max-width: 569px) 100vw, 569px\" \/><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 3:<\/strong> Right Click on Stay signed in and select Inspect<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2763 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_26.png\" alt=\"\" width=\"439\" height=\"508\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_26.png 582w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_26-259x300.png 259w\" sizes=\"(max-width: 439px) 100vw, 439px\" \/><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 4:<\/strong> Inspect the element Stay signed in<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2764 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_27.png\" alt=\"\" width=\"704\" height=\"346\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_27.png 783w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_27-300x148.png 300w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_27-768x378.png 768w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_27-780x385.png 780w\" sizes=\"(max-width: 704px) 100vw, 704px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2765 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_28.png\" alt=\"\" width=\"657\" height=\"564\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_28.png 805w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_28-300x258.png 300w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_28-768x659.png 768w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">[highlight color=&#8221;red&#8221;]First Click[\/highlight]\u2013 checkbox was clicked<\/span><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2766 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_29.png\" alt=\"\" width=\"415\" height=\"178\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_29.png 576w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_29-300x129.png 300w\" sizes=\"(max-width: 415px) 100vw, 415px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">[highlight color=&#8221;red&#8221;]Second click[\/highlight] \u2013 checkbox was unchecked<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The <\/span><b>isSelected()<\/b><span style=\"font-weight: 400;\"> method is used to know whether the Checkbox is selected on or off.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s create a test case in which we will automate the following scenarios to handle Checkbox:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Invoke a Google chrome browser.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Navigate to the website in which you handle the checkbox.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Select the <\/span><b>\u2018Armed Forces\/ Military ID card\/ Dependent ID card\u2019<\/b><span style=\"font-weight: 400;\"> checkbox from the spicejet website.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Close the driver.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Now, we will create a test case step by step in order to understand of how to handle checkbox.<\/span><\/p>\n<p><b>Step 1:<\/b><span style=\"font-weight: 400;\"> Launch the <a href=\"https:\/\/www.h2kinfosys.com\/blog\/selenium-jars-download-configure-eclipse\/\">Eclipse IDE<\/a><\/span><\/p>\n<p><b>Step 2: <\/b><span style=\"font-weight: 400;\">Right click on the src folder and click on the New &gt; class.<\/span><\/p>\n<p><b>Step 3: <\/b><span style=\"font-weight: 400;\">Enter the Class Name as (Checkbox)<\/span><\/p>\n<p><b>Step 4:<\/b><span style=\"font-weight: 400;\"> Invoke the Google Chrome browser and set the system property to the path of your chromedriver.exe file.<\/span><\/p>\n<p><b>Step 5:<\/b><span style=\"font-weight: 400;\"> Navigate to the \u201cspicejet\u201d website.<\/span><\/p>\n<h4><em><strong>Here is the complete code for above scenario:<\/strong><\/em><\/h4>\n<pre><b>import<\/b><span style=\"font-weight: 400;\">\u00a0org.openqa.selenium.WebDriver;\u00a0\u00a0<\/span>\n<b>import<\/b><span style=\"font-weight: 400;\">\u00a0org.openqa.selenium.chrome.ChromeDriver;\u00a0\u00a0<\/span>\n\n<b>public<\/b><span style=\"font-weight: 400;\">\u00a0<\/span><b>class<\/b><span style=\"font-weight: 400;\">\u00a0Checkbox {\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">\u00a0<\/span>\n<span style=\"font-weight: 400;\">\u00a0<\/span><b>public<\/b><span style=\"font-weight: 400;\">\u00a0<\/span><b>static<\/b><span style=\"font-weight: 400;\">\u00a0<\/span><b>void<\/b><span style=\"font-weight: 400;\">\u00a0main(String[]\u00a0args)\u00a0{\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">\/\/\u00a0TODO\u00a0Auto-generated\u00a0method\u00a0stub<\/span><span style=\"font-weight: 400;\">\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">\u00a0System.setProperty(<\/span><span style=\"font-weight: 400;\">\"webdriver.chrome.driver\"<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">\u201c<\/span><span style=\"font-weight: 400;\"> D:\\\\Drivers\\\\geckodriver.exe<\/span><span style=\"font-weight: 400;\"> \"<\/span><span style=\"font-weight: 400;\">);\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">\u00a0WebDriver\u00a0driver\u00a0=\u00a0<\/span><span style=\"font-weight: 400;\">new<\/span><span style=\"font-weight: 400;\">\u00a0ChromeDriver();\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">\u00a0driver.get(<\/span><span style=\"font-weight: 400;\">\"https:\/\/www.spicejet.com\/\"<\/span><span style=\"font-weight: 400;\">);\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\">}\u00a0\u00a0<\/span><\/pre>\n<p><b>Step 6:<\/b><span style=\"font-weight: 400;\"> Now we try to locate the \u201cArmed Forces\/ Military ID card\/ Dependent ID card\u201d checkbox by inspecting its HTML code.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2768 \" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_30.png\" alt=\"\" width=\"627\" height=\"252\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_30.png 779w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_30-300x121.png 300w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_30-768x309.png 768w\" sizes=\"(max-width: 627px) 100vw, 627px\" \/><\/p>\n<p><b>Note the id attribute of a \u201cArmed Forces\/ Military ID card\/ Dependent ID card\u201d checkbox.<\/b><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2769 aligncenter\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_31.png\" alt=\"\" width=\"579\" height=\"64\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_31.png 706w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/04\/Screenshot_31-300x33.png 300w\" sizes=\"(max-width: 579px) 100vw, 579px\" \/><\/p>\n<p><b>Step 7:<\/b><span style=\"font-weight: 400;\"> Write the code to handle the \u201cForces\/ Military ID card\/ Dependent ID card\u201d checkbox.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import org.openqa.selenium.By;\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">import org.openqa.selenium.WebDriver;\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">import org.openqa.selenium.chrome.ChromeDriver;\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">public class Checkbox<\/span>\n<span style=\"font-weight: 400;\">{\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">public static void main(String[] args)\u00a0\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">{\u00a0\u00a0<\/span>\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ TODO Auto-generated method stub\u00a0 \n<\/span><span style=\"font-weight: 400;\">  System.setProperty(<\/span><span style=\"font-weight: 400;\">\"webdriver.chrome.driver\"<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">\u201c<\/span><span style=\"font-weight: 400;\">D:\\\\Drivers\\\\geckodriver.exe<\/span><span style=\"font-weight: 400;\"> \"<\/span><span style=\"font-weight: 400;\">);\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WebDriver driver = new ChromeDriver();\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 driver.get(<\/span><span style=\"font-weight: 400;\">\"https:\/\/www.spicejet.com\/\"<\/span><span style=\"font-weight: 400;\">);\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(driver.findElement(By.id(\"ctl00_mainContent_chk_IndArm\")).isSelected());\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">driver.findElement(By.id(\"ctl00_mainContent_chk_IndArm\")).click();\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(driver.findElement(By.id(\"ctl00_mainContent_chk_IndArm\")).isSelected());\u00a0\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">driver.close();\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\u00a0\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">} <\/span><\/pre>\n<h3><strong>We have used two methods in the above code:<\/strong><\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><b>isSelected():<\/b><span style=\"font-weight: 400;\">\u00a0This method defines whether the checkbox is selected or not. If the checkbox is selected, then this method will return true otherwise false.<\/span><\/li>\n<li><b>click():<\/b><span style=\"font-weight: 400;\">\u00a0This method selects the locator. In this case, it is selecting the &#8220;<\/span><span style=\"font-weight: 400;\">Forces\/ Military ID card\/ Dependent ID card<\/span><span style=\"font-weight: 400;\"> &#8221; checkbox.<\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Selenium WebDriver CheckBox and Radio Button handling is one of the most fundamental skills every automation tester must master while working with web applications. Checkboxes and radio buttons are widely used in forms, login pages, booking portals, and user preference settings. Understanding how to identify, select, deselect, and validate their states using Selenium WebDriver helps [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":2809,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[571,572,570,448],"class_list":["post-2759","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-selenium-tutorials","tag-checkbox","tag-radio-button","tag-selecting-checkbox-and-radio-button","tag-selenium-webdriver"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/2759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=2759"}],"version-history":[{"count":1,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/2759\/revisions"}],"predecessor-version":[{"id":33287,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/2759\/revisions\/33287"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media\/2809"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=2759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=2759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=2759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}