package tools;
/**
* @author Seven Qi
* @date 2012-8-31 下午5:51:51
* @version 1.0
*/
import org.openqa.selenium.WebDriver;
public class SwitchTo {
public static void SwitchToWindowByTitle(WebDriver driver, String title) {
for (String wd : driver.getWindowHandles()) {
driver.switchTo().window(wd);
if (driver.getTitle().equals(title))
break;
}
}
public static void SwitchToWindowByUrl(WebDriver driver, String url) {
for (String wd : driver.getWindowHandles()) {
driver.switchTo().window(wd);
if (driver.getCurrentUrl().equals(url))
break;
}
}
}