How To Automate Selecting A Checkbox In Selenium Webdriver

Опубликовано: 07 Май 2026
на канале: Teach Yourself Test Automation
649
2

How To Automate Selecting A Checkbox In Selenium Webdriver | http://teachyourselftestautomation.com
Selenium Certification Training: http://bitly.com/2PA8HCA

Hello and welcome to Day 18 - How To Automate Selecting A Checkbox In Selenium Webdriver

Straight forward video today

Using the my practice website https://www.dyn-web.com/tutorials/for...

On above website we have five check boxes we could make a selection from mushrooms, onions, black olives, sausage and pepperoni

So we go ahead and inspect the checkbox for onions by right clicking on it the selecting inspect from drop down list presented

From inspecting the element it is clear we could use name attribute to select onions checkbox

Again we could use a line of code before selecting the checkbox to find out if it's selected or not so this time it should return false because it's before you select it and you will want to print output
into the console to validate return is correct

Same line of code could be put in script after you have run code to select checkbox and in this instance it should return a true and validate from print output in console

Also you could be asked to find out count of check boxes on page you will identify all check boxes by using common attribute to all check boxes right xpath or css to locate all and print to output console .size
should return count of all check boxes with same xpath in this case result is 5

Please see video for live examples on the above

Don't forget to subscribe if you found this video helpful and support the channel

Many Thanks

Kevin Owasu Itoe

How To Automate Selecting A Checkbox In Selenium Webdriver | http://teachyourselftestautomation.com
--------------------------------------------------------------------------------------------------------
Follow me @
Facebook:   / kevin.itoe.50  
Google+: https://plus.google.com/u/0/103559195...
Pinterest: https://www.pinterest.co.uk/owasuik/
My Blog: http://teachyourselftestautomation.com/
My YouTube Channel:    / @teachyourselftestautomatio1271  
--------------------------------------------------------------------------------------------------------
My Videos:
   • Install And Configure Java | Selenium Webd...  
   • Eclipse Installation | eclipse software | ...  
   • Java Project Template | Java Projects | My...  
   • Download And Configure Selenium | Selenium...  
   • Basic Selenium Test Script To Invoke Web B...  
   • Selenium Tutorial | WebDriver Browser And ...  
   • Selenium Webdriver Locators | Locators In ...  
   • Find Elements On Web Page With Link Text X...  
   • How To Validate Xpath And CSS Using Browse...  
   • How To Write Customized Xpath In Selenium ...  
   • CSS Selector | How To Write Custom CSS Sel...  
   • Preceding-Sibling Xpath | How To Identify ...  
   • How To Handle Static Dropdown Selenium Web...  
   • What Is The Difference Between Absolute XP...  
   • Video  
   • How To Automate Selecting A Checkbox In Se...  
-------------------------------------------------------------------------------------------------------
What Wikipedia says about selenium: https://en.wikipedia.org/wiki/Seleniu...)
What Wikipedia says about test automation: https://en.wikipedia.org/wiki/Test_au...