Recall & Review
beginner
What does the
isDisplayed() method check in Selenium?It checks if a web element is visible on the page to the user. If the element is hidden or not present, it returns false.
Click to reveal answer
beginner
What is the purpose of the
isEnabled() method in Selenium?It checks if a web element is enabled and can be interacted with, like a button that is clickable or a text box that can be typed into.
Click to reveal answer
beginner
How does
isSelected() help in testing?It checks if an element like a checkbox, radio button, or option in a dropdown is currently selected or checked.
Click to reveal answer
beginner
Example: What will
checkbox.isSelected() return if the checkbox is checked?It will return
true because the checkbox is selected.Click to reveal answer
intermediate
Why is it important to check element state before interacting in Selenium tests?
Because trying to click or type on invisible, disabled, or unselected elements can cause test failures or errors. Checking state helps write stable tests.
Click to reveal answer
Which Selenium method checks if an element is visible on the page?
✗ Incorrect
isDisplayed() returns true if the element is visible to the user.
What does
isEnabled() return if a button is grayed out and cannot be clicked?✗ Incorrect
isEnabled() returns false if the element is disabled and cannot be interacted with.
Which element state method would you use to check if a checkbox is checked?
✗ Incorrect
isSelected() checks if checkboxes or radio buttons are selected.
If
element.isDisplayed() returns false, what does it mean?✗ Incorrect
isDisplayed() returning false means the element is not visible on the page.
Why should you check
isEnabled() before clicking a button?✗ Incorrect
Checking isEnabled() ensures the button can be clicked without errors.
Explain the difference between
isDisplayed(), isEnabled(), and isSelected() in Selenium.Think about what each method tells you about the element's state.
You got /3 concepts.
Describe a scenario where checking element state methods prevents test failures.
Consider what happens if you interact with elements not ready for action.
You got /3 concepts.