This is what my code looks like
public void someTest() {
String x = "/html/body/div/div["
String y = "]/a"
for (int i = 1; i < 5; i++){
String links = x + i + y;
driver.findElement(By.xpath(links)).click(); // This will iteratively go to the next link and click on it
}
}
What I'm trying to achieve, however, is that once it clicks on the link, it should then look for descendant links and click on those as well. So is there a way of doing that? If I try something like the following, would that work?
driver.findElement(By.xpath(links/descendant::a).click();