断言是测试框架里的,和selenium没有关系的,你断言想怎么写就可以怎么写哈,2.0里面遇到Alert可以这么去搞:
try {
//Get the Alert
Alert alert = driver.switchTo().alert();
//Get the Text displayed on Alert using getText() method of
Alert class
String textOnAlert = alert.getText();
//Click OK button, by calling accept() method of Alert Class
alert.accept();
//Verify Alert displayed correct message to user
assertEquals("Hello! I am an alert box!",textOnAlert);
} catch (NoAlertPresentException e) {
e.printStackTrace();
}