The page that I want to check contains a text/sentence which randomly changes every day. What I’m thinking to do is to get all the texts that may randomly show up on the page and then whenever I execute my test case, it will check if the currently displayed text on the page is one of the expected texts to display.
I’m thinking of storing these expected texts in an array but I’m not sure how to write it in codes.
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
def candidates = ["Hi Ho", "Foo Bar", "Ya, Ya, Ya", "Make Appointment"]
WebUI.openBrowser('')
WebUI.navigateToUrl("http://demoaut.katalon.com")
def sb = new StringBuilder()
for (text in candidates) {
if (sb.length() > 0)
sb.append('|')
sb.append(text)
}
println("\"" + sb.toString() + "\"")
WebUI.verifyTextPresent(sb.toString(), true)
WebUI.closeBrowser()