How can I verify the title of a Web page (title is too long, it can only have 50 characters) by using assert?

Hello! As I am new to Katalon i might have some difficulties… sorry if my questions seems to easy…
Can anyone tell me how can I verify the title of a Web page (title is too long, it can only have 50 characters) by using assert?
I tried like this katalon2 but it didn’t work… Any ideas?
Thank you!

@II30 Either keep the last boolean of verifyMatch already set to true so you can use Regular Expression or you could grab only the first 50 characters and compare them.

WebUI.verifyMatch(WebUI.getWindowTitle(),“ExpectedTitle.*”, true) <–add dot asterisk to middle part

or

WebUI.verifyMatch(WebUI.getWindowTitle().substring(1,49),“49 chars of ExpectedTitle”, false)

and only copy the first 49 characters of the title. Review the report of the match to see if we are one character out–too many or too few.

1 Like