public void switchToParentWindow ( ) { String action = "Switching back to parent window" ; String expected = "Parent window is available and selected" ; try { driver . switchTo ( ) . window ( parentWindow ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Parent window was unable to be selected. " + e . getMessage ( ) ) ; log . warn ( e ) ; return ; } reporter . pass ( action , expected , expected ) ; }
Switches to the originally opened window . This is an alternative to switchNextTab or switchPreviousTab as this works better for some systems and environments that others .