Hi Ilya
TestObjects are a means to “wrap” the details of DOM elements and provide an interface to Katalon code. It is unfortunate that, if you want to use the majority of the Katalon framework and its WebUI APIs, you have to use TestObjects to access elements on a page. TestObjects are a “cost” you have to pay when you “buy into” the Katalon WebUI and framework. However, there are other ways…
“Spy Web”. I used the spy tool for about a day when I first started using Katalon – it’s a cumbersome UI and unwieldy UX that creates an even more cumbersome tree of objects. But you don’t even need it.
One solution is to build your own objects by hand and store them in the repository. An object needs a name and a means to access/find the real DOM element when used in a test. I use CSS but if you know xpath, you can use that instead. Make sure you understood what I just said: a name and a CSS selector – that’s all you need. By the time I’ve started the Spy tool and spun up a browser and fiddled around with the highlighter, I can create three or four objects by hand and be using them in tests. And my tree makes perfect sense to me afterwards.
If you have a large web application to test (mine has 105 pages with most containing 50 or more controls with multiple tables/grids and buttons), then you will have many hundreds (thousands?) of objects that need to be created and stored in the repository. I soon realized the object repository doesn’t scale well and is yet another bad idea.
But you don’t need that either…
build ONE object and reuse it over and over by modifying it with WebUI.modifyObjectProperty.
Fixed period delays: You’re right – they are rarely a good idea. But you do need to wait – testing code runs far quicker than a browser which needs to layout HTML, reformat for CSS and run javascript (if present). So it is much better to wait for known conditions to arise. For example, wait until an element is present (or visible) before attempting to access it in your test case.
Now to your error: findTestObject wants the path to your test object as it is stored in the object repository. So, if your text box (input type=“text”) has the name ABC in the repository, and your page is called mypage and you have your objects stored in the repository grouped by page, then:
WebUI.waitForElementPresent(findTestObject("mypage/ABC"), 30)
Personally, I would prefer to check for visibility:
WebUI.waitForElementVisible(findTestObject("mypage/ABC"), 30)
In the repository, your ABC object will need a CSS setting like so:
#ABC
or the equivalent xpath, if you prefer.
In my code base, your test step would look like this (which I think is what you were expecting to get for free from Katalon – perhaps KMS will add this capability in a future release?)
waitVisible("#ABC")
I hope this was some help?
Russ
p.s. @KMS it sounds like I am having a rant at how bad Katalon Studio is: not true. KS is the best testing solution available by a long way. Sure, it needs work and some of the tools are cumbersome but you guys are doing a great job and this community is testament to that.