Search code examples
htmlelements

How does lazy loading work with the Yandex HtmlElements?


Standard WebElement behavior

Standard WebElement lazy loading works as follows:

// Will not try to find button until perform an operation on it such as button.click();
@FindBy(id = "button")
private WebElement button;

// Button list will be created immediately
@FindBy(id = "button")
private List<WebElement> buttons;

// Button list will be created after waiting 5 seconds
@Timeout(5)
@FindBy(id = "button")
private List<WebElement> buttons;

Yandex HtmlElements/TypifiedElement behavior

Will the following be loaded immediately or lazily loaded when first used?

@FindBy(id = "button")
private CustomButton button;        // Extends TypifiedElement

@FindBy(id = "block")
private CustomComponent block;      // Extends HtmlElements

Solution

  • It works the same way as standard WebElements - the search for elements will be executed first time when you try access them.