I have multiple elements on a page and I would like to initialize them using PageFactory.
I have tried using following
@FindBy(xpath = "//*[contains(@class,'x-grid-tree-node-leaf')]")
List<WebElement> allElements;
but this returns only one element.
now, if I use the traditional way for finding elements
List<WebElement> allElements = driver.findElements(By.xpath("//*[contains(@class,'x-grid-tree-node-leaf')]"));
this returns 4 elements
any pointers what could be the issue?
@FindBy(xpath = "//*[contains(@class,'x-grid-tree-node-leaf')]")
List<WebElement> allElements;
this works. there was bug in my code.