1. 切換到另外一個handlecss
Set<String> winHandles;
winHandles = driver.getWindowHandles();
Assert.assertEquals(winHandles.size(), 2, "message.");
for (String handle : winHandles) {
if (!handle.equals(mainHandle)) {
driver.switchTo().window(handle);
break;
}
}get
2. 切換到iframeiframe
String mainHandle = driver.getWindowHandle();
driver.switchTo().frame(driver.findElement(By.cssSelector("#MIFind")));
it