延迟加载如何与 Yandex HtmlElements 一起使用?

How does lazy loading work with the Yandex HtmlElements?

标准 WebElement 行为

标准 WebElement 延迟加载的工作方式如下:

// 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 行为

第一次使用时是立即加载还是延迟加载?

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

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

它的工作方式与标准 WebElements 相同 - 元素搜索将在您尝试访问元素时首次执行。