How to verify text with several text lines?


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”

1 Like

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.") }