Bird
0
0

Consider this Page Object method:

medium📝 Predict Output Q5 of 15
Selenium Java - Page Object Model
Consider this Page Object method:

public boolean isLoginButtonDisplayed() {
    return loginButton.isDisplayed();
}

What will this method return if the login button is hidden on the page?
AThrows ElementNotVisibleException
Bfalse
Cnull
Dtrue
Step-by-Step Solution
Solution:
  1. Step 1: Understand isDisplayed() method

    isDisplayed() returns true if element is visible, false if hidden but present.
  2. Step 2: Analyze hidden element scenario

    If loginButton is hidden but present in DOM, isDisplayed() returns false, no exception.
  3. Final Answer:

    false -> Option B
  4. Quick Check:

    isDisplayed() returns false if element hidden [OK]
Quick Trick: isDisplayed() returns false for hidden elements [OK]
Common Mistakes:
MISTAKES
  • Expecting true for hidden elements
  • Assuming null return
  • Confusing with exceptions for missing elements

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes