📜  在 selenium 中切换窗口的语法 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:36.048000             🧑  作者: Mango

代码示例1
To handle separate tabs/windows we have to switch to that tab 
• Web driver handles one page/html document at a time. 
• To control another tab, we always need to switch 
• To be able switch we need to get the window handle first using 
getWindowHandles() method driver.switchTo.window(String) // à window handle 
//for each loop : driverGetWIndowHandles: 
Driver.switchTo.window(“handle”) 
Ifdriver.getTitle==expectedtitle;
Break;