Element¶
Overview¶
The Element class serves as a fundamental building block for constructing user interface (UI) components. It acts as a wrapper around Selenium WebElement, Appium WebElement, and Playwright Locator objects, offering additional utility methods and abstractions to facilitate interaction with web page elements within the Page Object Model (POM) and Page Component Object Model (PCOM) patterns.
Core Benefits & Rules¶
Simplified web element interactions:
Elementmethods provide a cleaner way to interact with web page element.
Enhanced wait mechanisms:
Built-in methods simplify web page element interaction waiting. For Selenium and Appium, using custom waits is generally preferred over implicit waits, especially for negative checks, as implicit waits can be slow in such scenarios.
Delayed initialization:
The
Elementobject has a delayed initialization within theGrouporPageclasses, where it is defined.
Attribute-based usage:
Unlike
GrouporPageobjects, which can be used as classes,Elementobjects should be defined as attributes. This approach promotes better code organization and reusability.
This section covers features and behaviour of Element class detail: