selenium-webdriverautomationkatalon-studiokatalon-recorder

Katalon Studio: How to handle disappearing validation or success messages?


There is situation while using Katalon Studio on automating my application.

On a form, Validation message shown with required fields (just like a tool tip) and disappears. Katalon could not detect this element. JavaScript is used at front end.

I want to put assert on this element.

Is there a way ? workaround ?


Solution

  • Using below javascript code helped me:

    JavascriptExecutor jse = (JavascriptExecutor)driver;
    
    WebElement field = driver.findElement(By.name("fname"));
    Boolean is_valid = (Boolean)jse.executeScript("return arguments[0].checkValidity();", field);
    String message = (String)jse.executeScript("return arguments[0].validationMessage;", field);