1 Answer

0 votes
by
// To store the list

List <WebElement> eleList = driver.findElements(By.xpath("xpath"));

// To fetch the size of the list

int listSize = eleList.size();

//for loop

for (int i=0; i<listSize; i++)

{

// Clicking on each link

links.get(i).click();

// Navigating back to the previous page that stores the links

driver.navigate().back();

}

1

2

3

4

5

6

7

8

9

10

11

12

// To store the list

List <WebElement> eleList = driver.findElements(By.xpath("xpath"));

// To fetch the size of the list

int listSize = eleList.size();

//for loop

for (int i=0; i<listSize; i++)

{

 // Clicking on each link

 links.get(i).click();

 // Navigating back to the previous page that stores the links

 driver.navigate().back();

}

Related questions

0 votes
asked Aug 22, 2019 in Selenium by john ganales
+1 vote
asked Aug 22, 2019 in Selenium by john ganales
...