Not able to click on all the links in Selenium Webdriver.Only the first link gets clicked
- by Kiran
.i want to go to a frame in which some links are there....Once I come in to a fram.i want to click all the links one by one..using webdriver...below is the code i have written.plz suggest me
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver=new FirefoxDriver();
driver.get("http://timesofindia.indiatimes.com/home");
WebDriverWait wait= new WebDriverWait(driver,200);
wait.until(ExpectedConditions.presenceOfElementLocated(By.id("riShop")));
driver.switchTo().frame("riShop");
List<WebElement> lst=driver.findElements(By.tagName("a"));
for(inti=0;i<lst.size();i++){
lst.get(i).click();
driver.navigate().back();
}
}
}
}
In the above code....only the first link gets clicked and then i get exception like..unable to locate the next element.....NoSuchException
plz suggest me something about it...