I have a List of Webelements out which a random element is selected. Now having a random webelement, i need to locate all the child elements in it. How can i acheive this in pagefactory.
In selenium, this was working:
List<WebElement> listOfElements = driver.findElements(By.xpath("//locator"));
WebElement randomElement = // Code to get a random element out of this list.
String title = randomElement.findElement(By.xpath(".//[@id='title']"));
In page factory, i have tried:
@FindBy(xpath="//locator")
List<WebElement> listOfElements;
@FindBy(id="title");
WebElement title;
WebElement randomElement = // Code to get a random element out of this list.
Stuck at how to fetch title in the random element using page factory annotations.
I know this would work:
String title = randomElement.findElement(By.xpath(".//[@id='title']"));
As i am using page factory annotations in the entire project, is there a way to achieve the same.