SHARE
TWEET

IMDb Top 250

SeleniumETrainR Dec 23rd, 2012 256 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import org.openqa.selenium.By;
  2. import org.openqa.selenium.WebDriver;
  3. import org.openqa.selenium.firefox.FirefoxDriver;
  4.  
  5.  
  6. public class TestIMDbTop250movies {
  7.  
  8.         public static String StartString=null;
  9.          public static String EndString=null;
  10.         public static void main(String[] args) {
  11.                 WebDriver myTestDriver = new FirefoxDriver();
  12.                 myTestDriver.manage().window().maximize();
  13.  
  14.                 myTestDriver.navigate().to("http://www.imdb.com/chart/top");
  15.                
  16.                 StartString = "//*[@id='main']/table[2]/tbody/tr[";
  17.                 EndString = "]/td[3]/font/a";
  18.                
  19.                 for(int i=2;i<=251;i++){
  20.                         System.out.println(myTestDriver.findElement(By.xpath(StartString + i + EndString)).getText());
  21.                         System.out.println(myTestDriver.findElement(By.xpath(StartString + i + EndString)).getAttribute("href"));;
  22.                          
  23.                 }
  24.                
  25.                 myTestDriver.quit();
  26.         }
  27.  
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top