Recall & Review
beginner
What is the main purpose of a Page Class in Selenium?A Page Class represents a web page in the application. It contains locators and methods to interact with page elements, making tests easier to read and maintain.Click to reveal answer
beginner
Why should locators be private in a Page Class?
Locators are private to hide the details of how elements are found. This protects the test code from changes in the page structure and encourages using methods to interact with elements.
Click to reveal answer
beginner
What is a good practice for naming methods in a Page Class?
Methods should be named clearly to describe the action, like 'clickLoginButton' or 'enterUsername'. This makes test steps easy to understand, like reading a story.
Click to reveal answer
intermediate
How does the Page Object Model improve test maintenance?
By separating page details from test logic, changes in the UI only require updates in the Page Class, not in every test. This saves time and reduces errors.
Click to reveal answer
intermediate
What should a Page Class NOT contain?A Page Class should not contain assertions or test logic. Its job is only to interact with the page. Assertions belong in the test code to keep responsibilities clear.Click to reveal answer
What does a Page Class typically contain?
✗ Incorrect
A Page Class holds locators and methods to interact with the web page elements, not test assertions or unrelated code.
Why is it important to keep locators private in a Page Class?
✗ Incorrect
Keeping locators private hides implementation details and encourages using methods, which improves code maintainability.
Which of the following is a good method name in a Page Class?
✗ Incorrect
Method names should clearly describe the action, like 'clickSubmitButton', making the code easy to read.
Where should assertions be placed when using Page Classes?
✗ Incorrect
Assertions belong in test code to keep Page Classes focused on page interactions only.
How does the Page Object Model help when the UI changes?
✗ Incorrect
POM centralizes UI details in Page Classes, so only those classes need updates when UI changes.
Explain the role and structure of a Page Class in Selenium testing.
Think about how a Page Class acts like a helper for tests.
You got /4 concepts.
Describe why keeping locators private and using methods in a Page Class improves test maintenance.
Consider how hiding details helps when the page changes.
You got /4 concepts.