Skip navigation links

Package hu.ibello.search

This package contains interfaces, annotations and enums used in element search.

See: Description

Package hu.ibello.search Description

This package contains interfaces, annotations and enums used in element search.

Ibello Element Search Engine

During element search we are trying to find some elements on the current page by specifying search conditions. These conditions are:

The result of an element search is a single WebElement instance, or a collection of elements: WebElements.

An elements search can be static or dynamic.

During a static element search the search conditions are specified with annotations added to fields of a page object (see PageObject). The search is performed automatically when the page object is initialized, and the results are stored in the field's value. These annotations are:

Examples:

  @Find(selector="button")
  @Position(type=PositionType.LEFT_FROM, selector="#ok-button")
 private WebElement cancelButton;
 
  @Find(by=By.TAG_NAME, selector="button")
  @Relation(type=RelationType.DESCENDANT_OF, selector="#modal-window")
 private WebElement modalButton;
 

During a dynamic element search java methods are called directly. This is possible with the use of SearchTool interface: it has some useful methods where the search conditions can be specified. Instances of this interface can be obtained by WebElement.find() and PageObject.find(). Examples (in a page object):

 WebElement okButton = find().using("#ok-button").first();
 WebElement cancelButton = find().using("button").leftFrom(okButton).first();
 WebElement modalButton = find().using("#modal-window").first().find().using(By.TAG_NAME, "button").first();
 
In some cases the desired elements are in a HTML iframe element. To find these elements, the page object, which contains those element references, should have a Frame annotation with the search properties of the iframe. In this case every element searches performed by that page object will be executed inside of that specific iframe.
Author:
Kornél Simon
Skip navigation links

Created by Kornél Simon, 2022