Thursday, April 4, 2013

Selenium : Initialising Objects

Initialising Objects

Example to open the browser and click on the Search button .


public class Test
{
 public static void test1() 
 {
  FirefoxDriver oFx=new FirefoxDriver ();   
  EventFiringWebDriver oEvent=new EventFiringWebDriver(oFx);
  oEvent.get("
http://www.google.co.in/");
  Thread.sleep(1000);

  WebElement oButton=oEvent.findElement(By.id("gbqfbb"));  //Object initialising
  oButton.click();
  System.out.print("Fin");

  oEvent.close();
  oEvent.quit();
}
}

No comments:

Post a Comment