Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Page Transactions structure automated tests around meaningful user operations—such as logging in, submitting a form, or changing a language—instead of making each test primarily a series of page-element manipulations. The pattern is an approach to organizing tests; Guará is a Python framework that implements it, not a tool every team must adopt.

What is a Page Transaction?

A Page Transaction represents a user operation as one named unit. In Douglas Cardoso’s January 31, 2025 DZone tutorial, each transaction is a class that inherits from AbstractTransaction and implements do. Driver calls inside do perform the operation, and the method can return a value for the test to check.

An Application runner invokes a transaction, while assertion classes inspect its result. That lets a test express its intent in a compact sequence: prepare the application, perform a named user action, check the outcome, and clean up.

Cardoso’s example changes a page’s language by invoking ChangeToPortuguese and ChangeToEnglish, then checking returned text with assertions. Form submission, login, and logout are other possible transactions. These examples show how the pattern is organized; they do not demonstrate measured reductions in code or maintenance effort.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How Page Transactions differ from Page Object Model

Page Object Model (POM) organizes automation around pages and their UI elements. Page Transactions organize it around actions and workflows. The difference is the primary unit of reuse, not whether the test interacts with the UI.

Consideration Page Transactions Page Object Model
Main unit A user operation, represented as a transaction. A page and the elements or behavior associated with it.
Cross-page workflows Can make a workflow spanning pages the named reusable unit. Typically composes interactions through page classes.
UI structure and locators Transactions still need updates when relevant UI structure changes. Page classes centralize page-specific details such as locators.
Reuse boundary Reuse an operation across tests that need that action; a fix to the transaction can affect those tests. Reuse page classes and their interactions wherever those pages are used.
Setup and learning Requires transaction classes and a shift toward action-centered design. May feel more familiar to teams already using page-oriented automation.

In his February 17, 2025 comparison, Cardoso describes POM as a reasonable fit for a simple UI structure or a team already familiar with it. He presents Page Transactions as a potential fit when workflows across pages are the more useful abstraction. Neither approach is best for every project; the choice depends on the application, test suite, and team.

Using Guará with Python, Selenium, and Pytest

Guará is the Python implementation shown in Cardoso’s tutorial. The tutorial uses Selenium WebDriver and Pytest, and its installation example is:

pip install guara

It then passes a Selenium WebDriver to Application, runs transaction classes through that runner, and uses assertions to check returned results. The tutorial also demonstrates running tests with logging enabled. These are the tutorial’s January 2025 instructions, not a guarantee that package interfaces or installation details remain unchanged. Consult the Guará project listing on PyPI for current package information before setting up a new project.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The tutorial author says the pattern is not bound to Selenium and describes a broader potential scope. That description should not be treated as independent compatibility evidence for other drivers or non-UI automation. The tutorial provides code and a sample log, but the material cited here does not independently verify package execution or compatibility across drivers.

When to consider the pattern—and how to migrate

Consider Page Transactions when tests repeatedly perform recognizable user operations, especially workflows that cross pages, and naming those operations would make test intent easier for your team to follow. POM may remain a better fit when page structure is the clearest organizing boundary or the team already works effectively with page objects.

Cardoso recommends an incremental migration rather than replacing page objects all at once:

  1. Identify the user operations that recur in existing tests and could form useful transactions.
  2. Convert actions gradually, beginning with tests that change frequently.
  3. Keep existing page-object code during the transition, introducing transactions where they help rather than forcing a wholesale rewrite.

These are the tutorial author’s migration suggestions, not universal rules. A transaction abstraction still has upkeep: changes to the UI can require transaction updates, and shared transactions mean a fix may affect multiple tests.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What the claimed benefits do—and do not—establish

Cardoso presents readability, maintainability, and flexibility as benefits of organizing tests around user operations. The tutorial and comparison are qualitative: they do not provide a named study, quantified performance result, or independently measured reduction in test code or maintenance cost. Treat those benefits as design goals to assess against your own suite, not guaranteed outcomes.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.