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

  1. Encapsulation of Page Elements and Groups:

    • The Page class 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 an Element or Group class, making it easy to interact with them directly.

  2. Initialization of Elements and Groups:

    • During the instantiation of a Page object, all defined elements and sections are automatically initialized. Detailed information: Page Initialisation

  3. Element Interactions:

    • The Page class 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.

  4. Page-Specific Methods:

    • In addition to element interactions, the Page class 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: