@ When ( "^I change active window$" ) public void seleniumChangeWindow ( ) { String originalWindowHandle = commonspec . getDriver ( ) . getWindowHandle ( ) ; Set < String > windowHandles = commonspec . getDriver ( ) . getWindowHandles ( ) ; for ( String window : windowHandles ) { if ( ! window . equals ( originalWindowHandle ) ) { commonspec . getDriver ( ) . switchTo ( ) . window ( window ) ; } } }
Change current window to another opened window .