Quality Testing

Quality is delighting customers

I want to click on links present in the diagram,and then come back and again click on second link and come back and so on........
Inline image 2

//Test 3:Manage My diamonds
driver.findElement(By.xpath("//a[@href='ManageMyDiamonds/']")).click();
List<WebElement>LinkBox =(List<WebElement>) driver.findElements(By.xpath("//ul[@class='tout']"));
      
        LinkBox.size();
    System.out.println(LinkBox.size());    
           
/* WebElement box = LinkBox.get(0);
List<WebElement>links =box.findElements(By.tagName("a"));
System.out.println("Total Links are"  +links.size());*/
for(int i=0; i<LinkBox.size(); i++){ 
System.out.println("************************************");
System.out.println(LinkBox.get(i).getText());
//System.out.println(LinkBox.get(i).getAttribute("href"));
//System.out.println(driver.getTitle());
    LinkBox.get(i).click();
    Thread.sleep(5000L);
  // LinkBox =(List<WebElement>) driver.findElements(By.xpath("//ul[@class='tout']"));
    System.out.println(driver.getTitle());
    driver.navigate().back();
 //   LinkBox =(List<WebElement>) driver.findElements(By.xpath("//ul[@class='tout']"));
}

Views: 82

Reply to This

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service