{"id":268,"date":"2020-12-29T03:44:40","date_gmt":"2020-12-29T03:44:40","guid":{"rendered":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/2020\/12\/29\/how-to-select-checkbox-and-radio-button-in-selenium-webdriver\/"},"modified":"2020-12-29T03:44:40","modified_gmt":"2020-12-29T03:44:40","slug":"how-to-select-checkbox-and-radio-button-in-selenium-webdriver","status":"publish","type":"post","link":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/2020\/12\/29\/how-to-select-checkbox-and-radio-button-in-selenium-webdriver\/","title":{"rendered":"How to Select Checkbox and Radio Button in Selenium WebDriver"},"content":{"rendered":"<p><html><body><\/p>\n<section class=\"tcb-post-content tcb-shortcode thrv_wrapper\" data-css=\"tve-u-16ec5d248bb\">\n<div class=\"tve_flt tcb-style-wrap\" id=\"tve_flt\">\n<div class=\"tve_shortcode_editor tar-main-content\" data-post-id=\"268\" id=\"tve_editor\">\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>In this article we will learn how to identify following form elements and work with it with real examples.<\/p>\n<div class=\"code-block code-block-2\" style=\"margin: 8px auto; text-align: center; display: block; clear: both;\">\n<p><!-- horizontal responsive 2 --><br \/>\n<ins class=\"adsbygoogle\" data-ad-client=\"ca-pub-3231318496783163\" data-ad-format=\"auto\" data-ad-slot=\"2788468763\" data-full-width-responsive=\"true\" style=\"display:block\"><\/ins>\n<\/div>\n<ul>\n<li>Radio button<\/li>\n<li>Check Box<\/li>\n<\/ul>\n<\/div>\n<div class=\"thrv_wrapper tve-toc tve-elem-scroll show-icon tve-toc-expandable tcb-local-vars-root\" data-animation=\"fade\" data-animation-speed=\"fast\" data-bullet-style='{\"0\":\"tve-u-17399af7dfd\",\"1\":\"tve-u-17399b007a8\",\"2\":\"tve-u-17399b014de\"}' data-columns=\"1\" data-columns-d=\"1\" data-css=\"tve-u-176ac7fbec7\" data-ct=\"toc-60677\" data-ct-name=\"Table of Contents 09\" data-element-name=\"Table of Contents\" data-headers=\"h1,h3,h5\" data-heading-style='{\"0\":\"tve-u-176ac7fbecf\",\"1\":\"tve-u-176ac7fbed1\",\"2\":\"tve-u-176ac7fbed3\"}' data-highlight=\"progressive\" data-number-style='{\"0\":\"tve-u-176ac7fbed0\",\"1\":\"tve-u-176ac7fbed2\",\"2\":\"tve-u-176ac7fbed4\"}' data-numbering=\"advanced\" data-state-default=\"expanded\" data-state-default-d=\"expanded\" data-transition=\"slide\" style=\"\">\n<div class=\"thrive-colors-palette-config\" style=\"display: none !important\"><\/div>\n<p><svg class=\"toc-icons\" style=\"position: absolute; width: 0; height: 0; overflow: hidden;\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><symbol data-id=\"icon-chevron-right-solid\" id=\"toc-bullet-0\" viewbox=\"0 0 320 512\"><path d=\"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z\"><\/path><\/symbol><symbol data-id=\"icon-chevron-right-solid\" id=\"toc-bullet-1\" viewbox=\"0 0 320 512\"><path d=\"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z\"><\/path><\/symbol><symbol data-id=\"icon-chevron-right-solid\" id=\"toc-bullet-2\" viewbox=\"0 0 320 512\"><path d=\"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z\"><\/path><\/symbol><\/svg><\/p>\n<div class=\"tve-toc-divider\" style=\"position: absolute; width: 0; height: 0; overflow: hidden;\">\n<div class=\"thrv_wrapper thrv-divider tve-vert-divider\" data-color-d=\"rgb(217, 217, 217)\" data-css=\"tve-u-176ac7fbec8\" data-style=\"tve_sep-1\" data-thickness-d=\"1\">\n<hr class=\"tve_sep tve_sep-1\" style=\"\"\/><\/div>\n<\/div>\n<div class=\"tve-content-box-background\" data-css=\"tve-u-176ac7fbec9\" style=\"\"><\/div>\n<div class=\"thrv_wrapper tve-toc-title reverse show-icon tcb-icon-display tve-no-dropzone tve-prevent-content-edit\" data-css=\"tve-u-176ac7fbeca\" style=\"\">\n<div class=\"tve-content-box-background\" data-css=\"tve-u-176ac7fbecb\" style=\"\"><\/div>\n<div class=\"tve-cb\" style=\"\">\n<div class=\"tve-toc-title-icon\" data-icon-code=\"icon-ellipsis-h-solid\" style=\"\"><svg class=\"tcb-icon\" data-id=\"icon-ellipsis-h-solid\" data-name=\"\" viewbox=\"0 0 512 512\"><path d=\"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z\"><\/path><\/svg><\/div>\n<div class=\"thrv_wrapper thrv_text_element tve_no_icons\" data-css=\"tve-u-176ac7fbecc\" style=\"\">\n<div class=\"tcb-plain-text\" style=\"\">Table of Contents<\/div>\n<\/p><\/div>\n<\/div>\n<\/div>\n<div class=\"tve-cb tve-toc-content tve-prevent-content-edit\">\n<div class=\"thrv_wrapper tve-toc-list tcb-no-delete tcb-no-save tcb-no-clone tve-no-dropzone\" data-css=\"tve-u-176ac7fbecd\" style=\"\">\n<div class=\"tve-content-box-background\" data-css=\"tve-u-176ac7fbece\" style=\"\"><\/div>\n<div class=\"tve-cb\">\n<div class=\"tve_ct_content tve_clearfix\">\n<div class=\"ct_column\">\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level1 tve_no_icons\" data-css=\"tve-u-176ac7fbed1\" data-element-name=\"Heading Level 2\" data-tag=\"H3\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number1 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed2\" data-element-name=\"Number Level 2\" data-level=\"1\" data-target=\"#t-1609211709392\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.1<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709392\" jump-animation=\"smooth\">Radio Button <\/a><\/div>\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level2 tve_no_icons\" data-css=\"tve-u-176ac7fbed3\" data-element-name=\"Heading Level 3\" data-tag=\"H5\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number2 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed4\" data-element-name=\"Number Level 3\" data-level=\"2\" data-target=\"#t-1609211709393\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.1.1<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709393\" jump-animation=\"smooth\">Test scenario to be automated <\/a><\/div>\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level2 tve_no_icons\" data-css=\"tve-u-176ac7fbed3\" data-element-name=\"Heading Level 3\" data-tag=\"H5\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number2 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed4\" data-element-name=\"Number Level 3\" data-level=\"2\" data-target=\"#t-1609211709394\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.1.2<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709394\" jump-animation=\"smooth\">Code to verify isDisplayed() method of Selenium WebDriver.\u00a0<\/a><\/div>\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level2 tve_no_icons\" data-css=\"tve-u-176ac7fbed3\" data-element-name=\"Heading Level 3\" data-tag=\"H5\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number2 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed4\" data-element-name=\"Number Level 3\" data-level=\"2\" data-target=\"#t-1609211709395\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.1.3<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709395\" jump-animation=\"smooth\">Code to verify isEnabled() method of Selenium WebDriver<\/a><\/div>\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level1 tve_no_icons\" data-css=\"tve-u-176ac7fbed1\" data-element-name=\"Heading Level 2\" data-tag=\"H3\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number1 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed2\" data-element-name=\"Number Level 2\" data-level=\"1\" data-target=\"#t-1609211709396\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.2<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709396\" jump-animation=\"smooth\">Check Box.<\/a><\/div>\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level2 tve_no_icons\" data-css=\"tve-u-176ac7fbed3\" data-element-name=\"Heading Level 3\" data-tag=\"H5\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number2 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed4\" data-element-name=\"Number Level 3\" data-level=\"2\" data-target=\"#t-1609211709397\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.2.1<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709397\" jump-animation=\"smooth\">How to perform validation on check box using Selenium WebDriver.<\/a><\/div>\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level2 tve_no_icons\" data-css=\"tve-u-176ac7fbed3\" data-element-name=\"Heading Level 3\" data-tag=\"H5\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number2 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed4\" data-element-name=\"Number Level 3\" data-level=\"2\" data-target=\"#t-1609211709398\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.2.2<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709398\" jump-animation=\"smooth\">How to use the isSelected() method to validate if the check box is selected?<\/a><\/div>\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level2 tve_no_icons\" data-css=\"tve-u-176ac7fbed3\" data-element-name=\"Heading Level 3\" data-tag=\"H5\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number2 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed4\" data-element-name=\"Number Level 3\" data-level=\"2\" data-target=\"#t-1609211709399\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.2.3<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709399\" jump-animation=\"smooth\">How to use the isDisplayed() method to validate if the check box is displayed?<\/a><\/div>\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level2 tve_no_icons\" data-css=\"tve-u-176ac7fbed3\" data-element-name=\"Heading Level 3\" data-tag=\"H5\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number2 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed4\" data-element-name=\"Number Level 3\" data-level=\"2\" data-target=\"#t-1609211709400\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.2.4<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709400\" jump-animation=\"smooth\">How to use the isEnabled() method to validate if the check box is enabled?<\/a><\/div>\n<div class=\"thrv_wrapper tve-toc-heading tve-toc-heading-level1 tve_no_icons\" data-css=\"tve-u-176ac7fbed1\" data-element-name=\"Heading Level 2\" data-tag=\"H3\">\n<div class=\"thrv_wrapper tve-toc-number tve-toc-number1 tve_no_icons tve-jump-scroll\" data-css=\"tve-u-176ac7fbed2\" data-element-name=\"Number Level 2\" data-level=\"1\" data-target=\"#t-1609211709401\" jump-animation=\"smooth\"><span class=\"tve-toc-disabled\">0.3<\/span><\/div>\n<p><a class=\"tve-toc-anchor tve-jump-scroll\" href=\"#t-1609211709401\" jump-animation=\"smooth\">Summary<\/a><\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv-divider tve-vert-divider\" data-color-d=\"rgb(217, 217, 217)\" data-css=\"tve-u-176ac7fbec8\" data-style=\"tve_sep-1\" data-thickness-d=\"1\">\n<hr class=\"tve_sep tve_sep-1\" style=\"\"\/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element tve-froala fr-box fr-basic\">\n<h3 class=\"\" id=\"t-1609211709392\"><strong>Radio Button<\/strong><strong> <\/strong><\/h3>\n<p>Radio button can too be work with click() method of Selenium WebDriver. Basically radio buttons have the functionality to be clicked once and selection is only performed on single WebElement and not on multiple elements.<\/p>\n<p>Let us understand Radio button with some example.<\/p>\n<h5 class=\"\" id=\"t-1609211709393\"><strong>Test scenario to be automated<\/strong><strong> <\/strong><\/h5>\n<ul>\n<li>Open following URL: <a class=\"tve-froala fr-basic\" href=\"https:\/\/rahulshettyacademy.com\/AutomationPractice\/\" style=\"outline: none;\">https:\/\/rahulshettyacademy.com\/AutomationPractice\/<\/a><\/li>\n<li>Inspect WebElement for radio buttons<\/li>\n<li>Radio1<\/li>\n<li>Radio2<\/li>\n<li>Radio3<\/li>\n<li>Perform click event on Radio2.<\/li>\n<li>Validate if radio button isSelected() using Selenium WebDriver methods.<\/li>\n<li>Perform click event on Radio1.<\/li>\n<li>Close WebDriver.<\/li>\n<\/ul>\n<p><strong>Below is java code for test scenario.<\/strong><\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\">\n<div class=\"tve-content-box-background\" data-css=\"tve-u-176ac84046e\" style=\"\"><\/div>\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac83d1a9\" style=\"\">\n<p data-css=\"tve-u-176ac83379d\" style=\"\"><span style=\"color: rgb(255, 255, 255);\">package tests;<\/p>\n<p>import org.openqa.selenium.By;<br \/>import org.openqa.selenium.WebDriver;<br \/>import org.openqa.selenium.WebElement;<br \/>import org.openqa.selenium.chrome.ChromeDriver;<\/p>\n<p>public class RadioButton {<br \/>\u00a0\u00a0\u00a0 public static void main(String[] args) {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.<em>setProperty<\/em>(&#8220;webdriver.chrome.driver&#8221;, &#8220;C:\\Users\\vikra\\Downloads\\chromedriver\\chromedriver.exe&#8221;);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebDriver driver = new ChromeDriver();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.manage().window().maximize();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.get(&#8220;https:\/\/rahulshettyacademy.com\/AutomationPractice\/&#8221;);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/Code to find Radio button with text Radio2 using XPath<br \/>\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0WebElement radio2=driver.findElement(By.<em>xpath<\/em>(&#8220;\/\/input[@value=&#8217;radio2&#8242;]&#8221;));<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 radio2.click();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/To validate if radio button is selected or not and performing click event on radio button.<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebElement radio1 = driver.findElement(By.<em>xpath<\/em>(&#8220;\/\/input[@value=&#8217;radio1&#8242;]&#8221;));<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 boolean selectState = radio1.isSelected();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/Code to check if radio button is already selected<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (!selectState){<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 radio1.click();<br \/><!--[if !supportLineBreakNewLine]-->\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/Close chrome driver<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.close();<br \/>\u00a0\u00a0\u00a0 }<br \/>}<br \/><\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>In the above code when driver comes to <strong>if condition<\/strong> the check will be made if the radio is selected or not, if selected condition will be false and driver will not go into if logic and test script will terminate indicating radio button is already selected. In this case since the radio button is not selected if condition is true driver moves into if logic and perform click operation on <strong>\u201cRadio1\u201d.<\/strong><\/p>\n<h5 class=\"\" id=\"t-1609211709394\"><strong>Code to verify isDisplayed() method of Selenium WebDriver.<\/strong><strong>\u00a0<\/strong><\/h5>\n<\/div>\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\">\n<div class=\"tve-content-box-background\" data-css=\"tve-u-176ac876d2d\" style=\"\"><\/div>\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac86f6d9\" style=\"\"><span style=\"color: rgb(255, 255, 255);\">import org.openqa.selenium.By;<br \/>import org.openqa.selenium.WebDriver;<br \/>import org.openqa.selenium.WebElement;<br \/>import org.openqa.selenium.chrome.ChromeDriver;<\/p>\n<p>public class RadioButton {<br \/>\u00a0\u00a0\u00a0 public static void main(String[] args) {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.<em>setProperty<\/em>(&#8220;webdriver.chrome.driver&#8221;, &#8220;C:\\chromedriver.exe&#8221;);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebDriver driver = new ChromeDriver();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.manage().window().maximize();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.get(&#8220;https:\/\/rahulshettyacademy.com\/AutomationPractice\/&#8221;);<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/To validate if radio button is selected or not and performing click event on radio button.<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebElement radio1 = driver.findElement(By.<em>xpath<\/em>(&#8220;\/\/input[@value=&#8217;radio1&#8242;]&#8221;));<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 boolean selectState = radio1.isDisplayed();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (!selectState){<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 radio1.click();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/Close chrome driver<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.close();<br \/>\u00a0\u00a0\u00a0 }<br \/>}<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>The above test will validate if the given radio button displays on the page or not. If displayed, then it will select. The output of the above code will be the same as was in the case of \u201c<strong>isSelected()<\/strong>\u201c. Because the specified radio button is displayed, and it will be selected using the click option.<\/p>\n<h5 class=\"\" id=\"t-1609211709395\"><strong>Code to verify isEnabled() method of Selenium WebDriver<\/strong><strong><\/strong><\/h5>\n<\/div>\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\">\n<div class=\"tve-content-box-background\" style=\"background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)) !important; background-size: auto !important; background-position: 50% 50% !important; background-attachment: scroll !important; background-repeat: no-repeat !important; --background-image:linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5))  !important; --background-size:auto auto  !important; --background-position:50% 50%  !important; --background-attachment:scroll  !important; --background-repeat:no-repeat  !important;\"><\/div>\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac8872f7\" style=\"\">\n<p data-css=\"tve-u-176ac8a0b1f\" style=\"\">package tests;<\/p>\n<p>import org.openqa.selenium.By;<br \/>import org.openqa.selenium.WebDriver;<br \/>import org.openqa.selenium.WebElement;<br \/>import org.openqa.selenium.chrome.ChromeDriver;<\/p>\n<p>public class RadioButton {<br \/>\u00a0\u00a0\u00a0 public static void main(String[] args) {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.<em>setProperty<\/em>(&#8220;webdriver.chrome.driver&#8221;, &#8220;C:\\chromedriver.exe&#8221;);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebDriver driver = new ChromeDriver();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.manage().window().maximize();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.get(&#8220;https:\/\/rahulshettyacademy.com\/AutomationPractice\/&#8221;);<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/To validate if radio button is enabled or not and performing click event on radio button.<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebElement radio1 = driver.findElement(By.<em>xpath<\/em>(&#8220;\/\/input[@value=&#8217;radio1&#8242;]&#8221;));<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 boolean selectState = radio1.isEnabled();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (!selectState){<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 radio1.click();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/Close chrome driver<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.close();<br \/>\u00a0\u00a0\u00a0 }<br \/>}<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element tve-froala fr-box fr-basic\">\n<p>The above code will first check if the element is in enabled status or not. If enabled, then it will perform the click operation. Else, no operation will perform. So, in this scenario, the radio button does not enable. Therefore, no click operation will perform on the specified radio button.<\/p>\n<h3 class=\"\" id=\"t-1609211709396\"><strong>Check Box.<\/strong><\/h3>\n<p>Check box is also selected using click() method of Selenium WebDriver, in this the driver check if the check box is selected or not and based on the condition perform selection operation on the check box.<\/p>\n<p>Let us understand check box using some real example.<\/p>\n<p><strong>Test scenario to be automated<\/strong><\/p>\n<ul>\n<li>Open following URL: <a class=\"tve-froala\" href=\"https:\/\/rahulshettyacademy.com\/AutomationPractice\/\" style=\"outline: none;\">https:\/\/rahulshettyacademy.com\/AutomationPractice\/<\/a><\/li>\n<li>Inspect WebElement for checkbox &#8211;\u00a0<\/li>\n<li>Option1<\/li>\n<li>Option2<\/li>\n<li>Option3<\/li>\n<li>Perform click event on Option3.<\/li>\n<li>Validate if check box isSelected() using Selenium WebDriver methods.<\/li>\n<li>Perform click event on Option1.<\/li>\n<li>Close WebDriver.<\/li>\n<\/ul>\n<\/div>\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\">\n<div class=\"tve-content-box-background\" style=\"background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)) !important; background-size: auto !important; background-position: 50% 50% !important; background-attachment: scroll !important; background-repeat: no-repeat !important; --background-image:linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5))  !important; --background-size:auto auto  !important; --background-position:50% 50%  !important; --background-attachment:scroll  !important; --background-repeat:no-repeat  !important;\"><\/div>\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac8cbeae\" style=\"\">\n<p data-css=\"tve-u-176ac8d833e\" style=\"\">package tests;<\/p>\n<p>import org.openqa.selenium.By;<br \/>import org.openqa.selenium.WebDriver;<br \/>import org.openqa.selenium.WebElement;<br \/>import org.openqa.selenium.chrome.ChromeDriver;<\/p>\n<p>public class CheckBox {<br \/>\u00a0\u00a0\u00a0 public static void main(String[] args) {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.<em>setProperty<\/em>(&#8220;webdriver.chrome.driver&#8221;, &#8220;C:\\Users\\vikra\\Downloads\\chromedriver\\chromedriver.exe&#8221;);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebDriver driver = new ChromeDriver();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.manage().window().maximize();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.get(&#8220;https:\/\/rahulshettyacademy.com\/AutomationPractice\/&#8221;);<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/To find web element using Xpath and performing click event on check box<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebElement option3=driver.findElement(By.<em>xpath<\/em>(&#8220;\/\/input[@value=&#8217;option3&#8242;]&#8221;));<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 option3.click();<br \/>\u00a0\u00a0\u00a0 }<br \/>}<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<h5 class=\"\" id=\"t-1609211709397\"><strong>How to perform validation on check box using Selenium WebDriver.<\/strong><\/h5>\n<p>Selenium WebDriver provides certain methods that we can use for a pre and post validation of the states of a CheckBox. Few of these methods are:<\/p>\n<ul type=\"disc\">\n<li>isSelected(): Checks whether a checkbox is selected or not.<\/li>\n<li>isDisplayed(): Checks whether a checkbox displays on the web page or not.<\/li>\n<li>isEnabled(): Checks whether a checkbox is enabled or not.<\/li>\n<\/ul>\n<h5 class=\"\" id=\"t-1609211709398\"><strong>How to use the isSelected() method to validate if the check box is selected?<\/strong><strong><\/strong><\/h5>\n<\/div>\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\">\n<div class=\"tve-content-box-background\" style=\"background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)) !important; background-size: auto !important; background-position: 50% 50% !important; background-attachment: scroll !important; background-repeat: no-repeat !important; --background-image:linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5))  !important; --background-size:auto auto  !important; --background-position:50% 50%  !important; --background-attachment:scroll  !important; --background-repeat:no-repeat  !important;\"><\/div>\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac8e8b42\" style=\"\">\n<p style=\"color: rgb(255, 255, 255) !important; --tcb-applied-color:rgb(255, 255, 255)  !important;\">package tests;<\/p>\n<p>import org.openqa.selenium.By;<br \/>import org.openqa.selenium.WebDriver;<br \/>import org.openqa.selenium.WebElement;<br \/>import org.openqa.selenium.chrome.ChromeDriver;<\/p>\n<p>public class CheckBox {<br \/>\u00a0\u00a0\u00a0 public static void main(String[] args) {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.<em>setProperty<\/em>(&#8220;webdriver.chrome.driver&#8221;, &#8220;C:\\chromedriver.exe&#8221;);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebDriver driver = new ChromeDriver();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.manage().window().maximize();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.get(&#8220;https:\/\/rahulshettyacademy.com\/AutomationPractice\/&#8221;);<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/To find web element using Xpath and performing click event on check box<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebElement option3=driver.findElement(By.<em>xpath<\/em>(&#8220;\/\/input[@value=&#8217;option3&#8242;]&#8221;));<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 boolean isSelected = option3.isSelected();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (!isSelected){<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 option3.click();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0 }<br \/>}<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>Once we ran this code, the code will first check whether the <em>checkbox<\/em> or not. Then an <em>if condition <\/em>will validate if the returned value is <strong>true<\/strong><em> <\/em>or <strong>false<\/strong>. In case it\u2019s false, i.e., the <em>checkbox will appear unchecked<\/em>. The code inside the <strong>if condition <\/strong>will execute, and the checkbox will check.<\/p>\n<h5 class=\"\" id=\"t-1609211709399\"><strong>How to use the isDisplayed() method to validate if the check box is displayed?<\/strong><strong><\/strong><\/h5>\n<\/div>\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\">\n<div class=\"tve-content-box-background\" style=\"background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)) !important; background-size: auto !important; background-position: 50% 50% !important; background-attachment: scroll !important; background-repeat: no-repeat !important; --background-image:linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5))  !important; --background-size:auto auto  !important; --background-position:50% 50%  !important; --background-attachment:scroll  !important; --background-repeat:no-repeat  !important;\"><\/div>\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac8fa0c9\" style=\"\">\n<p style=\"color: rgb(255, 255, 255) !important; --tcb-applied-color:rgb(255, 255, 255)  !important;\">package tests;<\/p>\n<p>import org.openqa.selenium.By;<br \/>import org.openqa.selenium.WebDriver;<br \/>import org.openqa.selenium.WebElement;<br \/>import org.openqa.selenium.chrome.ChromeDriver;<\/p>\n<p>public class CheckBox {<br \/>public static void main(String[] args) {<br \/>System.setProperty(&#8220;webdriver.chrome.driver&#8221;, &#8220;C:\\chromedriver.exe&#8221;);<br \/>WebDriver driver = new ChromeDriver();<br \/>driver.manage().window().maximize();<\/p>\n<p>driver.get(&#8220;https:\/\/rahulshettyacademy.com\/AutomationPractice\/&#8221;);<\/p>\n<p>\/\/To find web element using Xpath and performing click event on check box<br \/>WebElement option3=driver.findElement(By.xpath(&#8220;\/\/input[@value=&#8217;option3&#8242;]&#8221;));<br \/>boolean isSelected = option3.isDisplayed();<\/p>\n<p>if (!isSelected){<br \/>option3.click();<br \/>}<br \/>}<br \/>}<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>The above test will validate if the given checkbox displays on the page or not. If it is displayed, then it will make a selection. The output of the above code will be the same as was in the case of \u201c<strong>isSelected()<\/strong>\u201d as the specified checkbox is displayed, and it will check using the click option.<\/p>\n<h5 class=\"\" id=\"t-1609211709400\"><strong>How to use the isEnabled() method to validate if the check box is enabled?<\/strong><\/h5>\n<p><strong><\/strong><\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\">\n<div class=\"tve-content-box-background\" style=\"background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)) !important; background-size: auto !important; background-position: 50% 50% !important; background-attachment: scroll !important; background-repeat: no-repeat !important; --background-image:linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5))  !important; --background-size:auto auto  !important; --background-position:50% 50%  !important; --background-attachment:scroll  !important; --background-repeat:no-repeat  !important;\"><\/div>\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac91c56a\" style=\"\">\n<p data-css=\"tve-u-176ac92d1ce\" style=\"\"><span style=\"color: rgb(255, 255, 255);\">package tests;<\/p>\n<p>import org.openqa.selenium.By;<br \/>import org.openqa.selenium.WebDriver;<br \/>import org.openqa.selenium.WebElement;<br \/>import org.openqa.selenium.chrome.ChromeDriver;<\/p>\n<p>public class CheckBox {<br \/>\u00a0\u00a0\u00a0 public static void main(String[] args) {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.<em>setProperty<\/em>(&#8220;webdriver.chrome.driver&#8221;, &#8220;C:\\chromedriver.exe&#8221;);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebDriver driver = new ChromeDriver();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.manage().window().maximize();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.get(&#8220;https:\/\/rahulshettyacademy.com\/AutomationPractice\/&#8221;);<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/To find web element using Xpath and performing click event on check box<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebElement option3=driver.findElement(By.<em>xpath<\/em>(&#8220;\/\/input[@value=&#8217;option3&#8242;]&#8221;));<br \/>\u00a0 \u00a0 \u00a0 \u00a0 boolean isSelected = option3.isEnabled();<\/span><\/p>\n<p style=\"color: rgb(255, 255, 255) !important; --tcb-applied-color:rgb(255, 255, 255)  !important;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (!isSelected){<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 option3.click();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0 }<br \/>}<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>The above code will first check if the element is in an enabled state or not; if enabled, it will perform the click operation. If disabled, it will not perform any operation.<\/p>\n<p><strong>Let us now check how we can perform click on all check box using for loop condition.<\/strong><\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\">\n<div class=\"tve-content-box-background\" style=\"background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)) !important; background-size: auto !important; background-position: 50% 50% !important; background-attachment: scroll !important; background-repeat: no-repeat !important; --background-image:linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5))  !important; --background-size:auto auto  !important; --background-position:50% 50%  !important; --background-attachment:scroll  !important; --background-repeat:no-repeat  !important;\"><\/div>\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac931efe\" style=\"\">\n<p data-css=\"tve-u-176ac93cd60\" style=\"\">package tests;<\/p>\n<p>import org.openqa.selenium.By;<br \/>import org.openqa.selenium.WebDriver;<br \/>import org.openqa.selenium.WebElement;<br \/>import org.openqa.selenium.chrome.ChromeDriver;<\/p>\n<p>import java.util.List;<\/p>\n<p>public class CheckBox {<br \/>\u00a0\u00a0\u00a0 public static void main(String[] args) {<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.<em>setProperty<\/em>(&#8220;webdriver.chrome.driver&#8221;, &#8220;C:\\chromedriver.exe&#8221;);<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 WebDriver driver = new ChromeDriver();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.manage().window().maximize();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.get(&#8220;https:\/\/rahulshettyacademy.com\/AutomationPractice\/&#8221;);<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/To find web element using Xpath and performing click event on check box<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 List&lt;WebElement&gt; checkboxes=driver.findElements(By.<em>xpath<\/em>(&#8220;\/\/input[@type=&#8217;checkbox&#8217;]&#8221;));<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for(int i = 0 ; i &lt; checkboxes.size(); i++){<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 checkboxes.get(i).click();<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/Close chrome driver<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 driver.close();<br \/>\u00a0\u00a0\u00a0 }<br \/>}<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<h3 class=\"\" id=\"t-1609211709401\"><strong>Summary<\/strong><\/h3>\n<p>The table below summarizes the commands to access each type of element discussed above.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_table tcb-fixed tcb-mobile-table\" data-css=\"tve-u-176ac9558bd\" data-ct=\"table-37798\" data-ct-name=\"Dotted lines\" data-element-name=\"Table\">\n<table class=\"tve_table tcb-fixed tve_table_flat\" data-cols=\"3\" data-css=\"tve-u-176ac9558be\" data-rows=\"2\" data-v=\"middle\">\n<thead data-css=\"tve-u-176ac9558bf\">\n<tr class=\"tve_table_row\">\n<th class=\"tve_table_cell\" data-css=\"tve-u-176ac9558c0\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac9558c1\">\n<p data-css=\"tve-u-176ac9558c2\"><span class=\"fr-marker\" data-id=\"0\" data-type=\"true\" style=\"display: inline-block; line-height: 0;\"><\/span><strong>Element<\/strong><span class=\"fr-marker\" data-id=\"0\" data-type=\"false\" style=\"display: inline-block; line-height: 0;\"><\/span><\/p>\n<\/div>\n<\/th>\n<th class=\"tve_table_cell\" data-css=\"tve-u-176ac9558c3\">\n<div class=\"thrv_wrapper thrv_text_element\">\n<p data-css=\"tve-u-176ac9558c4\"><strong>Command<\/strong><\/p>\n<\/div>\n<\/th>\n<th class=\"tve_table_cell\" data-css=\"tve-u-176ac9558c5\">\n<div class=\"thrv_wrapper thrv_text_element\">\n<p data-css=\"tve-u-176ac9558c6\"><strong>Description<\/strong><\/p>\n<\/div>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody data-css=\"tve-u-176ac9558cb\">\n<tr class=\"tve_table_row\">\n<td class=\"tve_table_cell\" data-css=\"tve-u-176ac9558cc\" data-th=\"Element\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac9558cd\">\n<p data-css=\"tve-u-176ac9558ce\">Check Box, Radio Button<\/p>\n<\/div>\n<\/td>\n<td class=\"tve_table_cell\" data-css=\"tve-u-176ac9558cf\" data-th=\"Command\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac9558cd\">\n<p data-css=\"tve-u-176ac9558d0\">click()<\/p>\n<\/div>\n<\/td>\n<td class=\"tve_table_cell\" data-css=\"tve-u-176ac9558d1\" data-th=\"Description\">\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-176ac9558cd\">\n<p data-css=\"tve-u-176ac9558d0\">Used to toggle the element on\/off<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tcb_flag\" style=\"display: none\"><\/div>\n<\/section>\n<p><\/body><\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article we will learn how to identify following form elements and work with it with real examples. Radio button Check Box Table of Contents 0.1 Radio Button 0.1.1 Test scenario to be automated 0.1.2 Code to verify isDisplayed() method of Selenium WebDriver.\u00a0 0.1.3 Code to verify isEnabled() method of Selenium WebDriver 0.2 Check [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-268","post","type-post","status-publish","format-standard","hentry","category-selenium","post-wrapper","thrv_wrapper"],"_links":{"self":[{"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=268"}],"version-history":[{"count":0,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/268\/revisions"}],"wp:attachment":[{"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}