
Introduction
In the field of UI test automation, the Page Object Model (POM) has become almost the industry standard. It is widely regarded as the best practice in UI test automation and almost the only choice for improving maintainability and scalability.
In my own work, although most of the UI automation frameworks I have helped build also followed this model, I secretly felt it was more of a development practice than an application practice. It is an expression of OOP (object-oriented) thinking in test automation implementation.
By chance I came across an article by the foreign blogger Shubham Sharma, “Beyond the Page Object Model - A Functional Approach to Test Automation”, which reflects on the POM model and proposes a functional model approach. (Follow the “read original” link at the end to jump to the original text)
Although I don’t know exactly how well it works in practice, listening to both sides makes one wiser, and broadening one’s thinking is never wrong.
The following is translated and compiled from the original blog post (help by Gemini).
About POM
The core idea of POM is to encapsulate page elements and browser interactions into clean, reusable objects.
Its approach is simple: create a class for each page or component, containing locators and methods that operate on those elements.
Although POM is an improvement over brittle scripts full of hard-coded elements, it is essentially a flawed abstraction. It applies object-oriented principles to a problem domain that is essentially procedural and behavior-driven, resulting in test suites that are hard to understand, tightly coupled to state, and difficult to scale.
Problems with POM
Take a typical POM implementation of a login flow as an example:
| |
Used in a test:
| |
At first glance, this looks clean. But beneath the surface, it introduces several serious problems:
Hidden state and tight coupling
The object stores a reference to the driver (page), creating an implicit dependency. This makes the page class impossible to test in isolation and locks its behavior to the browser’s runtime state.
Scattered user logic
A user journey like “log in, go to settings, change the password” becomes a chain of method calls across multiple page objects. The workflow is fragmented - rather than being a coherent, testable unit.
Rigidity and bloat
Some new flows, such as SSO login, are forced to add more methods (violating the single-responsibility principle) or create new classes (leading to duplication). Over time, your page objects either bloat or split apart.
POM treats the page as the unit of abstraction. But a page is only context.
What truly matters is the user’s actions.
The Alternative - A Functional Model with Composable Workflows
The functional model flips this script. It treats user behavior, not UI structure, as the primary abstraction.
Step 1: Separate the data (locators)
Keep selectors as plain, immutable data - no methods, no state:
| |
Step 2: Write stateless interaction functions
Instead of binding methods to a class, write reusable, stateless functions:
| |
These can be reused throughout the application, are easy to test independently, and can be improved centrally (for example, adding retries, waits, and logging).
Step 3: Compose user workflows declaratively
Build real user journeys as first-class functions:
| |
Now your tests read like a story:
| |
Why This Approach Is Recommended
True composability
You are not just calling methods; you are building workflows. The login() function can be composed into a changePassword() workflow, or combined with navigation steps. Functions become meaningful, testable units.
Improved clarity
Tests are no longer imperative scripts executing UI operations step by step. Instead, they become declarative pipelines of user intent, easier to read, write, and understand.
Centralized maintenance
Fixing a flaky selector or improving click behavior happens in one place and propagates everywhere. No more hunting through class methods scattered across files.
A paradigm shift in testing
The Page Object Model reflects a legacy paradigm, object-oriented programming, in which everything is modeled as a “thing” with state and behavior. But UI testing is not about things; it is about flows.
By embracing functional thinking, we model tests as composable pipelines of user behavior rather than rigid objects. These workflows are:
- Stateless
- Isolated
- Declarative
- Easy to test
- Easy to change
- Easy to compose
The key takeaway
Stop asking: “What page object do I need here?”
Start asking: “What user workflow do I want to describe?”
The answer will guide you to build a simpler, cleaner test suite that is closer to the real user experience, one built not on inheritance and hidden state, but on pure functions and composable flows. This is not just a coding style; it is a better mental model for testing.
Conclusion - Toward a More Natural Way of Testing
The Page Object Model was once an important advance in UI test automation, but as test complexity grows and software development philosophy evolves, its limitations become increasingly apparent. The functional approach offers us a more natural, more flexible alternative.
By shifting the focus from page structure to user behavior, from object state to workflows, we can create tests that are closer to the real user experience. This approach not only improves code maintainability and readability, more importantly, it changes our understanding of the nature of testing.
In the modern world of rapidly changing software development, we need testing strategies that can adapt to change. The functional testing approach is exactly such a strategy - flexible, composable, easy to maintain, and able to evolve as the application grows.
