Technical Writing

Does it make sense to have Page Object Model in AI era?

08-08-2026

If you've worked in test automation, you already know Page Object Model. You separate your test logic from the details of the UI. Each view, as small as a header or a login form, gets its own class. That class owns every logical action tied to that view. Your test files stay small, clean and readable.

The difference

Imagine two codebases. Firt with no POM, every test file has its own locators, its own click logic, its own assertions, all mixed together. In the second, the tests built on top of POM, reads like an user journey written in plain English and hides all the implementation details.

Ask an AI agent to fix a broken selector in the first codebase and it has to go hunting. It searches for that selector across every test file that might reference it, checks whether the same element gets addressed three different ways in three different places, and tries to guess whether changing one occurrence might quietly break two others it didn't touch. That search burns context, and burned context is exactly what causes an agent to miss something.

Ask the same question in the POM codebase and the agent goes straight to one file. Every test that depends on that element inherits the fix automatically, because they were never storing their own copy of that logic to begin with.

Many assume that once AI got good enough at writing code, patterns like POM would matter less. Fewer humans reading the code, less need to organize it for human eyes. But the reality is just opposite. An agent making a change still has to figure out where that change belongs and what else it might affect. That's not a typing problem AI solved by getting faster. That's a reasoning problem, and reasoning gets easier or harder depending on how the code is shaped, whether the reasoner is a person or a model. A tangled test file forces the agent to hold the whole thing in its context to be safe. A page class lets the agent look at one small, bounded piece and know it's not stepping on anything else. Context windows are large, sure, but large doesn't mean free. Every extra file the agent has to load and cross-check is a chance for it to miss something or misjudge a side effect.

An Old Lesson Holds

Its not only POM as a special case, every coding pattern which we learnt still holds.

Being it naming conventions, single responsibility per file, consistent folder structure, clear boundaries between modules. Each one works like a contract with whoever, or whatever, touches the code next. Change a locator and there's one place to update it. Change a data model and you know which layer owns it.

An agent asking where a new piece of logic belongs gets the same answer a human teammate would, because the codebase carries that answer on its own. Good structure used to read as documentation for a human colleague. Now it doubles as information an AI model reads off the shape of the codebase itself, structure that tells it where to look without anyone writing a comment or a prompt to explain it.

Speed was never the hard part. Any model generates a function or a class in seconds. The hard part was always knowing where that logic belongs and what depends on it, and that's what disciplined patterns solved long before anyone asked an AI to write a line of code. Naming conventions, separation of concerns, consistent file organization: these existed to make a codebase legible to the next reader.

AI models turned out to be capable readers too, once you hand them a codebase built with that legibility in mind.