easyConceptCodingEntryMid
What belongs in a page object, and what should never go in one?
5 min readUpdated 2026-08-15
Answer
Short answer
A page object owns locators and the mechanics of interacting with a screen, and nothing else. Assertions, test data and workflow belong in the test, because the moment a page object asserts, the test's intent stops being readable from the test.
Mention test automation where it changes the risk, the owner, or the next check. A useful test automation point should make the answer more testable, not merely longer. Tie test automation back to the scenario so the interviewer can see why it matters here.
Was this answer helpful?
Likely follow-ups
- Your login method asserts the dashboard loaded. What breaks about that?
- Where does a multi-page checkout flow live if not in a page object?
- How do you choose a locator that survives a front-end rewrite?
- When would you not use page objects at all?
Related questions
- Walk me through waiting in Selenium: implicit versus explicit, why you get StaleElementReferenceException, and how page objects fit in.mediumAlso on selenium and page-object5 min
- How do you decide what to automate and what to leave manual?mediumAlso on test-automation6 min
- Which tests should run on every commit and which should run nightly, and how do you decide?mediumAlso on test-automation7 min
- Your test suite fails randomly about one run in five. How do you get it under control?hardAlso on test-automation7 min