Use Contains with WebUI

How do I compare text from two pages where that text is not the exact same?
Like Page 1 has text like: abcxyz and Page 2 has: bcxy. (which is how it should work in my application)
I need to use something with contains but only with WebUI and not string.
Please help with this ASAP.

Why only WebUI keywords? There is not such keyword right now, but this code works as you want:

boolean isSubstringPresent(String subString, String fullString) {
	return fullString.contains(subString)
}

println isSubstringPresent("bcxy", "abcxyz") // true
println isSubstringPresent("bcd", "abcxyz") // false
1 Like

@Marek_Melocik

Thanks for the help though.
I also found one WebUI which can fulfil my ‘Contains’ requirement that is
WebUI.verifyTextPresent("." + bcxy + "."; true)

True, but this keyword search the text on whole page - you cannot specify an element.
If this is suitable for you, then go for it.

1 Like