0
0
Selenium Javatesting~5 mins

Checking state (isDisplayed, isEnabled, isSelected) in Selenium Java - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AisDisplayed()
BisEnabled()
CisSelected()
DisVisible()
What does isEnabled() return if a button is grayed out and cannot be clicked?
Afalse
Btrue
Cnull
Dthrows exception
Which element state method would you use to check if a checkbox is checked?
AisDisplayed()
BisSelected()
CisChecked()
DisEnabled()
If element.isDisplayed() returns false, what does it mean?
AElement is enabled
BElement is visible
CElement is hidden or not present
DElement is selected
Why should you check isEnabled() before clicking a button?
ATo confirm the button is visible
BTo confirm the button is selected
CTo confirm the button is hidden
DTo confirm the button is clickable
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.