How to use the WebUI.setText() custom keyword successfully?
Have you ever experienced frustration when the system behaves differently during automation testing than it does during manual testing?
For example, a search box with autocomplete functionality. When you enter a value into the search box, the result will be displayed in real-time. However, it does not occur in all cases.
The reason for this is that not all system behavior could be perfectly replicated by Selenium keywords in all current instances.
We will be sharing 3 custom keywords below, which can cover Selenium keywords with the cases above:
- setTextWithJavascript
CustomKeywords.'EnhancedWebUI.setTextWithJavascript'(inputTestObject, 'hello')
- setTextWithJQuery
CustomKeywords.'EnhancedWebUI.setTextWithJQuery'(inputTestObject, 'hello')
- setTextWithBuiltInKeyword
CustomKeywords.'EnhancedWebUI.setTextWithBuiltInKeyword'(inputTestObject, 'hello')
You can download the 3 files below and put them under the Keywords folder of the Katalon Projects.
Sample Test Script.groovy (2.0 KB)
JQueryMin.groovy (90.1 KB)
EnhancedWebUI.groovy (13.4 KB)
Moreover, we provide a custom keyword named EnhancedWebUI.verifyElementSetTextable
CustomKeywords.'EnhancedWebUI.verifyElementSetTextable'(inputTestObject, 'hello', true)
It helps you determine which mentioned methods above work for your case.
Let us know if the custom keywords that we have provided works for you. And if they do, then donât forget to show us some love by clicking on the like button below !
And feel free to leave us your feedback so that we could improve our articles in the future!
We also have other topics related to working with custom keywords in Katalon Studio, check them out below
How to use the Windows.switchToDesktop() custom keyword to switch window faster?
How to use the WebUI.setText() custom keyword successfully? â You are here
How to use the WebUI.dragAndDropToObject custom keyword successfully?