Chatbot test - How to grab text, store and compare

I’m quite new to automation and Katalon, at the moment I need to implement a solution for a Chatbot project we’re delivering. My idea is to Get the response text and compare it against a responses file.
I’ve been trying using the GetText function and storing the value as a string.
Unfortunately, everything I’ve tried fails. Is there any advice on how could I achieve this?

Example of one solution I’ve tried

String WelcomeText = WebUI.getText(findTestObject(‘Page_DPC Vic Bot/Page_DPC Vic Bot/p_Welcome’))
WebUI.verifyEqual(WelcomeText, findTestData(‘Welcome Text’).getValue(‘Intent’, 1))

In general terms, that looks fine, assuming your test objects are targeting the correct elements on the page. You may need to wait until your TOs are available - understand that all browsers are slow and test code is lightning fast.

To find out if you have timing issues because your test is too fast, try waiting for the p_Welcome TO to appear:

https://docs.katalon.com/katalon-studio/docs/webui-wait-for-element-visible.html

1 Like