Hi Tarun,
I have tried u r method by fetching the size and iterating element using the index value
//Code
public static void main(String args[])throws Exception
{
WebDriver driver = new FirefoxDriver();
driver.get("
http://www.hrs.com");
List<WebElement> MyList = driver.findElements(By.xpath("//a"));
int linkcount =MyList.size();
System.out.println(linkcount); ----------> o/p : 104
for (int i=1;i<linkcount;i++)
{
driver.findElement(By.xpath("//a['"+i+"']")).click(); -> same url (www.hrs.com is loaded for 104 times )
}
}
Problem i face here is, link count is 104, For each iteration it loads the same page( i.e www.hrs.com is loaded for 104 times)
Thanks
ganesh