Interview question bank

Interview Questions

Prepare for real-world SDET, QA Automation and Software Testing interviews. Every question includes an answer, explanation and practical context.

0 completed · 0 bookmarked
Showing 121–160 of 1,279 questions
← Previous 40 questions

Quick interview answer

Keep page objects for pages, but extract reusable widgets (header, data grid, date picker, modal) as component objects that take a root locator and are composed into pages.

Detailed explanation

Modern apps are built from components, so a pure page-per-URL model duplicates the same grid or dialog code across many pages. A component object scopes all its lookups to a root element, so two instances of the same widget on one page do not collide. Pages then become thin compositions that expose business actions. Avoid PageFactory's @FindBy with lazy proxies if your app re-renders heavily — resolving locators at call time is more predictable, and returning the next page object from navigation methods keeps flows readable.

java
1public class DataGrid {
2 private final SearchContext root;
3 private final WebDriver driver;
4
5 public DataGrid(WebDriver driver, By rootLocator) {
6 this.driver = driver;
7 this.root = driver.findElement(rootLocator);
8 }
9
10 public List<String> column(String header) { /* scoped lookups only */ }
11 public void sortBy(String header) { /* ... */ }
12}
… 4 more lines

Real-world example

Three pages shared the same results grid; extracting one component object deleted about 400 duplicated lines.

Interview tip

Explain the root-locator scoping — it is the detail that distinguishes component objects from a renamed page object.

Show more questions (40 more of 1,119 remaining)