how to display assert message of assert.isDisplayed in logs or console output in jenkins with java

23 Views Asked by At

I am trying:

    public void assertIsDisplayed(WebElement element) {
        {
           String actualText = element.getText();
           
           try {
                Assert.assertTrue(element.isDisplayed(), actualText + " is not displayed on the page");
                Reporter.log(actualText + " is displayed on the page",true);
                } 
           catch (AssertionError e) {
                Reporter.log("Assertion Error: " + e.getMessage());
                throw e;
            }
     }
     }

but in console output or logs failed message is not displayed.

0

There are 0 best solutions below