How to switch control from child window to parent window in selenium webdriver?

后端 未结 8 1395
一个人的身影
一个人的身影 2020-12-03 17:38
  • From Parent window I\'m passing the control to child window
  • I\'m performing actions in the child window
  • After performing, from a child window one mor
8条回答
  •  盖世英雄少女心
    2020-12-03 18:15

    String Parent_Window = driver.getWindowHandle();    
    
     for (String Child_Window : driver.getWindowHandles())  
     {  
     driver.switchTo().window(Child_Window);  
     //Perform operation on child window 
     driver.close();
     } 
    
     //Switching back to Parent Window  
     driver.switchTo().window(Parent_Window);  
    

提交回复
热议问题