SHARE
TWEET

Top 35 inspirational movies

SeleniumETrainR Dec 23rd, 2012 84 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 TestTop35inspirationalmovies {
  7.  
  8.  public static String StartString=null;
  9.  public static String EndString=null;
  10.  
  11.  
  12.         public static void main(String[] args) {
  13.                  
  14.                 WebDriver myTestDriver = new FirefoxDriver();
  15.                 myTestDriver.manage().window().maximize();
  16.  
  17.                 myTestDriver.navigate().to("http://www.imdb.com/list/GyzpQ_PZLcg/");
  18.                
  19.                 StartString = "//*[@id='main']/div/div[7]/div[";
  20.                 EndString = "]/div[3]/b/a";
  21.                
  22.                 for(int i=1;i<=35;i++){
  23.                         System.out.println(myTestDriver.findElement(By.xpath(StartString + i + EndString)).getText());
  24.                         System.out.println(myTestDriver.findElement(By.xpath(StartString + i + EndString)).getAttribute("href"));;
  25.                          
  26.                 }
  27.                
  28.                 myTestDriver.quit();
  29.                  
  30.         }
  31.  
  32. }
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