I have a table of names and each of the names can be accessed by the following XPath: //*[@id="right_pane"]/div[1]/table/tbody/tr[INDEX]/td[2]
where index is a number. What's the best way to search for these XPaths while using Selenium? My current solution is the following:
- Replace INDEX with 0
- Search for element
- Check if element is the correct one
- Increment INDEX and repeat
The process above seems inefficient as the starting index varies (I start at 0 but it's possible the first entry in the table starts at index 200) and searching for each element takes up to seconds (using an implicit wait until in selenium).
Is there a better approach to this problem? Or am I stuck searching 1 by 1?