Recall & Review
beginner
What is a checkbox in web testing?
A checkbox is a small box on a web page that a user can check or uncheck to select or deselect an option.
Click to reveal answer
beginner
How do you check if a checkbox is selected using Selenium in Java?
Use the
isSelected() method on the checkbox WebElement. It returns true if checked, false if not.Click to reveal answer
intermediate
How to select a checkbox only if it is not already selected in Selenium Java?
First check
if (!checkbox.isSelected()), then call checkbox.click() to select it. This avoids toggling it off accidentally.Click to reveal answer
beginner
What is the best locator strategy for finding a checkbox in Selenium?
Use unique and stable locators like
id or name attributes. Avoid brittle locators like XPath with indexes.Click to reveal answer
intermediate
Why should you verify the checkbox state after clicking it in tests?
Because clicking might fail or not change the state due to page issues. Verifying ensures your test only passes if the checkbox is actually selected or deselected as expected.
Click to reveal answer
Which Selenium method checks if a checkbox is selected?
✗ Incorrect
The
isSelected() method returns true if the checkbox is checked.What should you do before clicking a checkbox to select it?
✗ Incorrect
Check if the checkbox is already selected to avoid toggling it off accidentally.
Which locator is best for finding a checkbox reliably?
✗ Incorrect
Unique id attributes are stable and reliable locators.
What does clicking a checkbox do?
✗ Incorrect
Clicking a checkbox toggles its state between selected and unselected.
Why verify checkbox state after clicking in tests?
✗ Incorrect
Verification ensures the checkbox state changed as expected after clicking.
Explain how to safely select a checkbox in Selenium Java.
Think about avoiding toggling off an already selected checkbox.
You got /4 concepts.
Describe best practices for locating and interacting with checkboxes in Selenium tests.
Focus on reliability and test accuracy.
You got /4 concepts.