关闭弹出方法不适用于所有测试

时间:2017-02-10 15:46:00

标签: java selenium selenium-webdriver webdriver

关闭弹出方法不适用于所有测试 例如,26项测试中有20项将通过。 2.对于未通过以下代码的六次测试,不会关闭popuo框

    public void closeAlertPopupBox() {
    try {
        Alert alert = wait.until(ExpectedConditions.alertIsPresent());
        alert.accept();
        System.out.println("The popup has been successfully closed");
    } catch (Exception e) {
        System.out.println("Unable to close the popup");
        Assert.assertFalse(true, "Unable to close the popup, Exception: " + e.getMessage());
    } finally{
        driver.switchTo().defaultContent();
    }
}

0 个答案:

没有答案