Wednesday, 2 September 2015

Handling multiple windows with Selenium WebDriver

With the help of below code you can easily handle different windows and can perform different operations


       // Store current window handle  
      String winHandleBefore = driver.getWindowHandle();  
      //Click on element which opens new window  
      // Switch to new window opened  
      for (String winHandle : driver.getWindowHandles())  
     // perform operation that opens new window  
     // Close the new window  
    // Switch back to original window  


No comments:

Post a Comment