java - Dynamic Element id in selenium @FindBy -


can throw light on how dynamically retrieve list of id pagesection. our page contains number of sections based on number of person information.each person form based pagesection.

here example.

@findby(css = "#personform0 > fieldset > div.apisinforequired.statusbox.active > div.btn.action.addbtn > input") public pageelement addinfantbtn;   @findby(css = "#personform1 > fieldset > div.apisinforequired.statusbox.active > div.btn.action.addbtn > input") public pageelement addadultbtn; 

#personform0 can go upto #personform9, when read using @findby, facing difficulty selenium. can share thought on how write this.

are able find elements has specific name or similar , iterate on them , determine if have found are searching for?

that is, instead of using

findelement(by.name("q")); 

are able use

findelements(by.name("q"));  

and iterate on list of web elements returned?

an example of html working give better answer.


Comments