Group¶
Overview¶
The Group class is a specialized Element that represents a collection of related elements within a web page.
It is specifically needed for the Page Component Object Model (PCOM), providing a higher-level abstraction for
organizing and interacting with groups of elements. This offers additional benefits over the base Element class,
making it easier to manage and interact with complex UI components as cohesive units.
Core Benefits & Rules¶
Encapsulation Elements:
The
Groupclass allows you to define and encapsulate all the web elements of a Group as attributes (known as Page Component Object Model). Each element is represented as an instance of anElementclass or similar, making it easy to interact with them directly.
Element Locating Context Modification:
The
Groupclass efficiently searches for element locators within its own context, instead of entire driver object. This enhances performance and minimizes unexpected behavior.
Class-Based Usage:
Unlike
Elementobjects, which can be used as attributes,Groupobjects should be defined as classes. This approach promotes better code organization and reusability.
Initialization of Elements:
During the instantiation of a
Groupobject, all defined attributes with instance ofElementare automatically initialized. This ensures that elements are ready for interaction as soon as the Group object is created. Logic same as forPageclass
This section covers features and behaviour of Group class detail: