//open browser
WebDriver driver=new
FirefoxDriver();
//navigate to website
driver.get(https://www.hdfcbank.com/);
//windowhandle of
parent browser
String
a=driver.getWindowhandle();
System.out.print(a);
//click on login button
driver.findElement(By.id(“loginsubmit”)).click();
//Size of
windowhandles child browser
Set<String> b=driver.getWindowhandles();
System.out.print(b.size());
// windowhandles
of child browser
Iterator<String>c=driver.getWindowHandles().iterator();
While(c.next()){
String d=c.hasnext();
driver.switchTo().Window(d);
String aTiltle=
driver.getTitle();
System.out.print(aTiltle);
if
(aTitle.equals("NetBanking"){
driver.close();
}
0 comments:
Post a Comment