It is likely that a text extracted from HTML is prepended/appended with whitespace characters (space,CR,LF,TAB). You should trim those whitespaces before making a strict assertion:
def expected = "Unpaid"
def actual = WebUI.getText(findTestObject("Page_MyLicense Office -admin/FeeStatusUnpaid"))
assert actual.trim().equals(expected)
Or alternatively use .contains()
rather than .equals()
for a tolerant assertion.
def expected = "Unpaid"
def actual = WebUI.getText(findTestObject("Page_MyLicense Office -admin/FeeStatusUnpaid"))
assert actual.contains(expected)
Sometimes Non-breaking space character(or \u00a0 in UNICODE) in HTML make things more complicated.