Katalon Analytics (beta) – Bringing new insights into test reports. Learn more!

How to verify text with several text lines ?

Hello,

We would like to verify a text showing up on one of our error messages and are unable to make it work in Katalon Studio.
In Selenium Webdriver we are using the following cause we need to add a new line:

"Please fill in these required field(s):"+"\n"+" New password"

Tried the same thing in Katalon but it wasn't successful.
We also tried this but again wasn't able to make it work.
"Please fill in these required field(s):"+"\r\n"+" New password"
and this also
"Please fill in these required field(s):\r\n New password"

Comments

  • What about String.matches Java function and use regex?

    String errorMsg = WebUI.getText(testObject)
    if(!errorMsg.matches("Please fill in these required field(s):(\n)New password")) {
    KeywordUtil.markFailed("Error message contains invalid text.")
    }
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion