Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99412

How to specify a list of elements in a pageobject without having a element for each of them

$
0
0

I have a long list of elements I would like to access. They all have a similar id with a index from 1 to 47. Is there a good way to access these as an array or list, as i would like to be able to iterate through them, instead of doing this for each single one

[FindsBy(How = How.Id, Using = "ElementId1")]
public IWebElement Element1;
[FindsBy(How = How.Id, Using = "ElementId2")]
public IWebElement Element2;
[FindsBy(How = How.Id, Using = "ElementId....")]
public IWebElement Element....;

and then making a list of the elements?

Can I somehow make a loop that finds them and puts them into an array itself so I don't need manually define each one?


Viewing all articles
Browse latest Browse all 99412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>