点击 www.msn.com 右上角上的link“ Make xinmsn my homepage ” , 弹出了个alert 如上图, 怎么在上面进行操作,选yes 和no。。。。作者: dian106106 时间: 2012-5-14 18:11
对了, 只能在ie上可以看到这个link,其他浏览器上没有的
附上一点脚本,请大家继续。。。。。
WebDriver driver = new InternetExplorerDriver();
String baseurl = "http://xin.msn.com/?lang=en-sg";
driver.get(baseurl);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.findElement(By.linkText("Make xinmsn my homepage")).click();
Alert alert = driver.switchTo().alert();
if(!alert.getText().equalsIgnoreCase("Would you like to use the following as your home page?")){
System.out.println("DHP alert not popup, pls check...");
}
//请继续。。。。。。作者: dian106106 时间: 2012-5-14 18:12
对了, 只能在ie上可以看到这个link,其他浏览器上没有的
附上一点脚本,请大家继续。。。。。
WebDriver driver = new InternetExplorerDriver();
String baseurl = "http://xin.msn.com/?lang=en-sg";
driver.get(baseurl);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.findElement(By.linkText("Make xinmsn my homepage")).click();
Alert alert = driver.switchTo().alert();
if(!alert.getText().equalsIgnoreCase("Would you like to use the following as your home page?")){
System.out.println("DHP alert not popup, pls check...");
}
//请继续。。。。。。