I use htmlelements pattern, similar on pagefactory. Search for elements going through the @FindBy. With some elements can not perform the action (click, sendkeys...), because form on the page is not fully to load and does not appear to perform an action on it, and the driver is already trying to do actions for it. Helps only method Thread.sleep(). But I would like to use Explicit Waits. Timeouts(), a member of the htmlelements not help. For example:
public class ButtonForm extends HtmlElement {
@FindBy(xpath = "//span[text()='Select']")
public Button selectButton;
public void selectButton() {
selectButton.click();
}
In the current test the behavior of a long running and there is no click operation. I would like to implement something like this ligament: "WebElement + WebDriverWait + ExpectedConditions"
The problem probably is here @FindBy(xpath = "//span[text()='Select']"). When you start xpath expression with a // selenium ignores element context and looking up from document root. So maybe your action (click, sendkeys) works, but on wrong elements. To fix this issue, start your xpath with a ./ or use css locators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With