reporter.log不会受到try和catch阻止

时间:2015-12-29 04:56:10

标签: selenium

以下是代码:

try {
    WebElement Link_Logout = wait.until(ExpectedConditions.elementToBeClickable(By.id("logoutLink"))); 
    if(Link_Logout.isEnabled()==true)
    {
        Reporter.log("<br>Step Logout: Customer has been logout successfully");
        Link_Logout.click();
        Assert.assertTrue(driver.getTitle().contains("Login"));
        Reporter.log("<br>Step Logout: Customer has been logout successfully");
    }
} catch(Exception exc) {
    if(exc instanceof WebDriverException || exc instanceof UnhandledAlertException) {
        Reporter.log("<br>Step Logout: Customer has not been logout successfully due to exception");
        System.out.println("The exception thrown here is :" +exc);
    }
}

注意:try块下的代码正在执行,但reporter.log无效。

0 个答案:

没有答案