Recall & Review
beginner
What is a radio button in web testing?
A radio button is a web element that allows the user to select only one option from a set of choices. Selecting one option automatically deselects the others.
Click to reveal answer
beginner
How do you locate a radio button using Selenium in Java?
You can locate a radio button using locators like
By.id, By.name, or By.xpath. For example: <br>driver.findElement(By.id("genderMale"))Click to reveal answer
beginner
How to check if a radio button is selected in Selenium Java?
Use the
isSelected() method on the WebElement. It returns true if the radio button is selected, otherwise false.Click to reveal answer
beginner
How to select a radio button using Selenium Java?
Call the
click() method on the WebElement representing the radio button. This simulates a user clicking and selecting it.Click to reveal answer
intermediate
Why should you verify a radio button's state after clicking it?
Because sometimes the click might not work due to page issues or scripts. Verifying with
isSelected() ensures the radio button is actually selected.Click to reveal answer
Which Selenium method checks if a radio button is selected?
✗ Incorrect
The isSelected() method returns true if the radio button is selected.
What happens when you select one radio button in a group?
✗ Incorrect
Radio buttons allow only one selection in a group; selecting one deselects others.
Which locator is best to uniquely identify a radio button?
✗ Incorrect
By.id is usually unique and best for locating a specific radio button.
What Selenium method simulates clicking a radio button?
✗ Incorrect
click() simulates a user clicking the radio button.
If a radio button is not selected after click(), what should you do?
✗ Incorrect
Check if the radio button is enabled and visible to ensure it can be clicked.
Explain how to select and verify a radio button using Selenium in Java.
Think about the steps a user takes and how Selenium mimics them.
You got /3 concepts.
Describe why radio buttons allow only one selection and how this affects test automation.
Consider real-life examples like choosing gender or payment method.
You got /3 concepts.