Hello Team can anyone help me out on this, I am not able to figure out why the error is coming
Kindly Help me
sorry for the delay
use it like this
[code:4svow8h0]package com.sample;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Rediff_1 {
public static void main(String[] args) {
WebDriver dr = new FirefoxDriver();
dr.get("http://in.rediff.com/");
dr.manage().window().maximize();
dr.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
WebElement shop = dr.findElement(By
.xpath("//*[@id='homewrapper']/div[5]/a[7]/div/u")); // In this
shop.click();
WebElement left_box = dr
.findElement(By.xpath("//*[@id='popular_cat']"));// here i am
List<WebElement> shop_links = left_box.findElements(By.tagName("a"));
System.out.println(shop_links.size());
for (int i = 0; i < shop_links.size(); i++) {
System.out.println(shop_links.get(i).getText());
shop_links.get(i).click();
System.out.println(dr.getTitle());// I have printed upto first link
// and first title here
// I repeated the below code which was written in top as we lost the
// web page memory in the cache
dr.get("http://in.rediff.com/");
dr.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
shop = dr.findElement(By
.xpath("//*[@id='homewrapper']/div[5]/a[7]/div/u"));
shop.click();
left_box = dr.findElement(By.xpath("//*[@id='popular_cat']"));
shop_links = left_box.findElements(By.tagName("a"));
}
}
}
[/code:4svow8h0]