-1
<i>
@FindAll(@FindBy(xpath = ".//input[contains(@name,'adv_xfer_fields') 
and contains(@name,'::amounts')]"))
List <WebElement> amounts;
</i>

I have dynamic web-table in the input field, Ideally I need to pass value to this. But I'm not sure how to implement this?

public List<WebElement> getAllAmounts() {
    return amounts;
}

Please help

Blauharley
  • 4,186
  • 6
  • 28
  • 47
  • 1
    You have only one FindBy criterion, what is the need for using FindAll? Refer to this - https://stackoverflow.com/questions/25914156/difference-between-findall-and-findbys-annotations-in-webdriver-page-factory – Grasshopper Dec 31 '17 at 07:16

1 Answers1

0

As per your question, I don't see any error in your tried out code but definately we can be a bit structured more precise as follows :

        @FindAll({@FindBy(xpath = ".//input[contains(@name,'adv_xfer_fields')]"),
                @FindBy(xpath = ".//input[contains(@name,'::amounts')]")}) 

        List <WebElement> amounts;

As per the documentation, FindAll is used to mark a field on a Page Object to indicate that lookup should use a series of @FindBy tags. It will then search for all elements that match any of the FindBy criteria though elements are not guaranteed to be in document order.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • The problem with this, while it is a valid FindAll, the original post has an "and" condition, and your example provides an "or" condition, since you stated it would find -any- of the FindBy's. I think the solution is just to remove the outer FindAll and keep the rest of the original poster's locator. – Bill Hileman Jan 02 '18 at 19:26