Set<String> handles = driver.getWindowHandles();
for (String h : handles) {
driver.switchTo().window(h);
if (driver.getTitle().contains("你想要切换到的页面的标题")) {
((ChromeDriver) driver).findElementByXPath("/html/body/div[1]/div[2]/div[2]/div[2]/form/div[2]/div/div/div/div/input").sendKeys("testycx3");
break;
}
}
05-01