Page¶
Overview¶
The Page class in Mops is designed to act as a flexible and adaptable page object, essential for
implementing the Page Object Model (POM). It dynamically adjusts its base class and behavior based on the underlying
driver (PlayPage for playwright, MobilePage for appium, or WebPage for selenium), allowing for consistent
and reusable page objects across different platforms.
Core Benefits & Rules¶
Encapsulation of Page Elements and Groups:
The
Pageclass allows you to define and encapsulate all the web elements and sections of a page as attributes (known as Page Object Model). Each attribute is represented as an instance of anElementorGroupclass, making it easy to interact with them directly.
Initialization of Elements and Groups:
During the instantiation of a
Pageobject, all defined elements and sections are automatically initialized. Detailed information: Page Initialisation
Element Interactions:
The
Pageclass provides methods for interacting with elements, such as clicking buttons, entering text, and verifying element states. This promotes reusability and reduces duplication of interaction logic across tests.
Page-Specific Methods:
In addition to element interactions, the
Pageclass supports defining page-specific methods that encapsulate common actions or workflows related to the page. This helps to keep test scripts clean and focused on the actions rather than on how to perform them.
This section covers features and behaviour of Page class detail: