Suggestions for creating new Keywords like waitForElementPresentAndClick

At my company, we run our tests in the selenium grid.
All our applications are SINGLE PAGE apps. AJAX requests firing off all the time.
We end up writing code that is not so easily readable.
Could Katalon introduce some new keywords like the ones below?

waitForElementPresentAndClickElement(findTestObject(obj)),GlobalVariable.SHORT_WAIT)
waitForElementClickableAndClickElement(findTestObject(obj)),GlobalVariable.SHORT_WAIT)
etc…
Our scripts are twice as long because we always have…
waitForElementPresent()…
Click()
waitForElementPresent()
Click()

We could make a custom keyword like the one I described above however, it would be nice for Katalon to offer such simple but powerful keywords.

Please let me know if this can be achieved.

Thank you!

Philip Novikov

1 Like

Suggestion:

Write your own. You obviously know the API set well enough to do that.

Katalon’s API is a (reasonably thin) layer over Selenium. It’s not a good idea to fold another notional layer into WebUI. Another, higher layer, WebUISuper (perhaps) would be better.

My personal approach would be to write a complete API in JavaScript and ditch WebUI altogether (apart from utilities like delay and executeJavaScript and a few other bits). You can write a full JS library and when you come to WebUI.executeJavaScript on one of your new APIs, prefix it with your new library.

“Won’t that be slow?”

No, not noticeably. You’re always waiting between clicks and other actions anyway.

It’s your call.

This is just a chain of actions.
So I see no obvious reason for this, since you can write your own CustomKeywords to reduce code duplication, as already pointed by @Russ_Thomas.

Katalon API should stay limited to very basic actions. The more complex a keyword will be, more fragile will be.

I guess, @philippe.novikof has muliple Katalon projects which demand waitForElementPresentAndClick keyword, but he does not know how to share his custom keyword implementation amongst the multiple projects.

Naturally he does not like to copy & paste the Groovy source of the keyword into multiple projects. Therefore he wants waitForElementPresentAndClick to be provided as a built-in feature.

IMHO, his discussion revealed a defect of the Katalon product. Katalon does not provide users with an easy way of sharing their custom keyword implementation. I think his point is spot on.

1 Like

Actually they do provide such, but recently became a paid feature.
read the release notes :stuck_out_tongue:

Really?

I could not find it in the Katalon Studio Release Notes: Version 8.x | Katalon Docs

Could you tell me how the feature’s is named?

Take that:

Changes

  • The import and export custom keywords feature is only available for Enterprise users.

I just tried the export / import keywords feature in Version 9.
Its literally just a copy and paste of the Keywords folder…

as i said, is already provided.
for how long and for what users, time will tell

note also:

  • Without KSE licenses, you can only create 40 test suites per project. Free users with existing projects of more than 40 test suites can still execute their test suites, but cannot create new ones.

so i won’t be surprised if a limitation on how many custom keywords you may use with a free licence will follow soon.

just saying