switch to multiple windows WebDriver

      set fxdriver=new FirefoxDriver();

///get all window handles
       Set wh=fxdriver.getWindowHandles();

////get the iterator
               Iterator ite=wh.iterator();

///get main window name
      String mainwind=ite.next().toString();

///get the next window name
       String newwname=ite.next().toString();
   
////switch to next window
       fxdriver.switchTo().window(wname);



//////////////////////////do all the action required


///////focus back to main window
      fxdriver.SwitchTo().Window(mainwind)

Comments