Tag: 尝试赶上

断言try / catch块不能按预期工作

当我运行我的Selenium脚本时,我使用了sorta的断言方法。 当断言得到满足(元素存在)时,脚本写入一个xls文件。 当它不符合时,脚本不写入xls文件,它停止在那里的testing。 try { assertEquals(driver.findElement(By.xpath(prop.getProperty("failedlogin"))).getText(), "LOG IN"); //add pass entry to the excel sheet testresultdata.put("4", new Object[] { 3d, "User should not be able to login with no password", "Login failed", "Pass" }); } catch (Exception e) { //add fail entry to the excel sheet testresultdata.put("4", new Object[] { 3d, "User should not be […]