Hi,
I am trying to use verifyText to verify en element that contains carriages return :
Text1
Text2
Text3
I tried to set Value such as “Text1\nText2\nText3” but it doesn’t work. How can I describe carriages return in the Value field ?
Thank you for your response.
Best regards.
MS
First, may I suggest you use double slashes in your comparison.
and you may need to set your boolean isRegex reference to true as in:
WebUI.verifyTextPresent('Text1\\nText2\\nText3', true)
Just a note that “\n” is a combo of carriage return and line feed (char(13) and char(10)). You can also try to use “\v” or “\R” or char(13) char(10).
You should use a Regular Expression with Character class \s
(a whitespace character: [ \t\n\x0B\f\r]
) and Quantifier *
(zero or more), +
(one or more).
....
WebUI.openBrowser('')
WebUI.navigateToUrl(url)
String expr = '\\s*Text1\\s+Text2\\s+Text3\\s*'
boolean result = WebUI.verifyTextPresent(
expr,
true, // 1st arg is Regular Expression
FailureHandling.CONTINUE_ON_FAILURE)
WebUI.closeBrowser()