Recall & Review
beginner
What is an element locator in Selenium?
An element locator is a way to find and select elements on a web page, like buttons or text fields, so you can interact with them in your tests.
Click to reveal answer
beginner
Why do we use a page class in Selenium tests?A page class groups all element locators and actions for one web page in one place. It makes tests easier to read and maintain, like having a map for that page.Click to reveal answer
beginner
Name four common locator strategies in Selenium.
Common locator strategies are: ID, Name, CSS Selector, and XPath. Each helps find elements differently, like using an address or a description.
Click to reveal answer
intermediate
What is the best practice for choosing locators in a page class?
Choose locators that are unique, stable, and simple. For example, prefer ID over XPath because IDs are usually unique and less likely to change.
Click to reveal answer
intermediate
How does using a page class improve test maintenance?If a page changes, you only update locators in one place—the page class—instead of many test files. This saves time and reduces errors.
Click to reveal answer
Which locator is usually the most reliable to use in Selenium?
✗ Incorrect
ID is usually unique and stable, making it the most reliable locator.
What is the main purpose of a page class in Selenium tests?
✗ Incorrect
A page class organizes locators and actions for one page, improving test clarity and maintenance.
Which locator strategy uses a path-like syntax to find elements?
✗ Incorrect
XPath uses a path syntax to navigate the HTML structure.
If a locator changes on the web page, where should you update it?
✗ Incorrect
Updating locators in the page class keeps tests consistent and easier to maintain.
Which of these is NOT a good locator choice?
✗ Incorrect
Random class names can change often, making tests fragile.
Explain how element locators and page classes work together in Selenium tests.
Think about how you find things on a map and keep the map updated.
You got /4 concepts.
Describe best practices for choosing element locators in a page class.
Imagine picking the easiest and most reliable way to find a friend in a crowd.
You got /4 concepts.