SHARE
TWEET

What are the Locating Techniques dynamic XPATH patterns / Ma

a guest Dec 13th, 2012 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.List;
  2. import java.util.concurrent.TimeUnit;
  3.  
  4. import org.openqa.selenium.By;
  5. import org.openqa.selenium.WebDriver;
  6. import org.openqa.selenium.WebElement;
  7. import org.openqa.selenium.firefox.FirefoxDriver;
  8.  
  9.  
  10. public class DynamicXpath {
  11.  
  12.         public static void main(String[] args) throws InterruptedException {
  13.                 WebDriver myTestDriver = new FirefoxDriver();
  14.                 myTestDriver.get("http://tinyurl.com/cn5pum8");
  15.                 myTestDriver.manage().window().maximize();
  16.                 myTestDriver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
  17.  
  18.                 List<WebElement> RadioNamelist = myTestDriver
  19.                                 .findElements(By
  20.                                 .xpath("//input[contains(@id,'-real')]"));
  21.                
  22.                 System.out.println(RadioNamelist.size());
  23.                
  24.                 for(int i=0;i<RadioNamelist.size();i++){
  25.                         System.out.println(RadioNamelist.get(i).getAttribute("name"));
  26.                 }
  27.  
  28.  
  29.                 myTestDriver.quit();
  30.         }
  31.  
  32.  
  33.          
  34.  
  35. }
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