Tuesday, September 10, 2013

Selenium : Creating Object Repository

Creating Object Repository



Since the "OR" File resides in the same package there is no need to import .


------------------------File Name : Sample1.java --------------------File1
public class Sample1
{
    public static void main(String[] args)   
    {       
        WebDriver oDriver=new FirefoxDriver();
        oDriver.get("https://www.google.co.in");
        WebElement oTitle=oDriver.findElement(By.xpath(OR.button));  // Directly using the static variable     }
}

===================================================================

------------------------File Name : OR .java--------------------File2
public class OR {

          public static final String button="//button[@id='gbqfba']";
       
}
===================================================================

No comments:

Post a Comment