I’m trying to match two values using command verifyElementText
Original html looks like this:
firstpart
secondpart.
The problem is i’m trying to match one string to two strings, cause when you run the test, the actual text looks like this:
'firstpart
second part.'
and expected value can only be stored in one string
'firstpart second part.'
Is there any way to solve this situation, and match both parts of a text to expected values?
Did you try using regex? You could parse the whole string using \s+ (one or more whitespace characters) or \b (word boundary).
What do you actually get when you extract the text into a variable and print it?
Sorry, i dont understand what you mean.
Firstly, I need to see what’s printed when you print the text to the log viewer. So get the text using https://docs.katalon.com/display/KD/[WebUI]+Get+Text
Then do
WebUI.comment(result)
regex is short for “Regular Expression”. It’s highly likely you can retrieve the text and verify it using a regex.
Here is the text from the log viewer:
[INFO] - В ближайшее время мы свяжемся с Вамидля уточнения деталей заказа.
If you copy/paste it, you will notice that there is end of line in the middle. The problem was solved by using string concatenation:
'В ближайшее время мы свяжемся с Вами' +
'\n' + 'для уточнения деталей заказа.'
Thanks for help.
Kudos. Glad you got it working.