Bird
0
0

Which of the following correctly demonstrates consuming these page objects in the test class?

hard📝 Conceptual Q8 of 15
Selenium Java - Page Object Model
You have a test class that uses two page objects: LoginPage and DashboardPage. After a successful login, you want to verify the dashboard title. Which of the following correctly demonstrates consuming these page objects in the test class?
AUse static methods in page objects without instantiation
BCall <code>DashboardPage</code> methods directly without login
CInstantiate only <code>LoginPage</code> and verify dashboard title there
DInstantiate <code>LoginPage</code> and call login, then instantiate <code>DashboardPage</code> to verify title
Step-by-Step Solution
Solution:
  1. Step 1: Understand page object usage

    Each page object represents a page; instantiate and use accordingly.
  2. Step 2: Test flow

    LoginPage.login() must be called first, then DashboardPage instantiated to verify dashboard.
  3. Final Answer:

    Instantiate LoginPage and call login, then instantiate DashboardPage to verify title -> Option D
  4. Quick Check:

    Use page objects sequentially per page flow [OK]
Quick Trick: Instantiate and use page objects per page flow [OK]
Common Mistakes:
MISTAKES
  • Skipping login before dashboard verification
  • Trying to verify dashboard in LoginPage
  • Using static methods improperly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes