How to Highlight Test object in each and every step

Katalon documentation is not a good place to look for tutorials on Java programming in general.

You should buy a book on Java.


the IF statements may look redundant, but I don’t think they are. :wink: What I’m trying to do with this construction is this: All built-in keywords that require a test object as an argument and are to be specially monitored due to a design decision of the test architect (to be maintained in the list influencedKeywords) lead to the coloring of the affected web elements on the web page and are specially error handled by caching all circumstances of their occurrence.

However, all other built-in keywords should (at least in my use case) also be error-monitored. But because I can’t be sure that they have a test object argument at all and also because they don’t fit to the context of the highlighted elements in the tcExceptionEvents object, I need the IF statement to differentiate everywhere, in the try as well as in each of the exception blocks.

But it’s certainly true that this is still not a complete solution. Because the possibility for error monitoring should actually exist for every single step in the test case, thus also for custom keywords and other commands. As a further development of the simple built-in error handling of Katalon Studio (with the options STOP_ON_FAILURE, CONTINUE_ON_FAILURE and OPTIONAL) you should be able to decide at a central point how to proceed due to the circumstances of an occurred error. So this can only be a start pointing in a possible direction.

I can only speak for myself, but in our company the stakeholders want to be informed immediately if a relevant error occurs. Speed and relevance are equally important, because false alarms are extremely annoying when they accumulate. That’s why I need ways to correctly address (stakeholders vs. test engineers) and channel (Telegram message vs. email) alarm notifications. Maybe I’ll tinker with it a little more …

I understand that you want to monitor all built-in keywords which take TestObject as args; not only the keywords listed in the influencedKeywords list.

I want to find out a way to do this. I would try
if (args[0] instanceof com.kms.katalon.core.testobject.TestObject)
to find if the keyword was invoked with a TestObject as the 1st argument.

I would continue studying…

In Feb I worked on my project to include the proposal by @Drunda_Nibel. In my GitHub project, I mad a branch named Drunda_Niebel. The most current code set is accessible at the following URL:

Unfortunately I encountered a blocking problem. Therefore I hesitated announcing this modified version.

What was the blocking problem?

  • git clone
  • git checkout Drunda_Nibel
  • start Katalon Studio (version 6.1.1 or under), open the project HighlightingElementByTestObjectInEachAndEveryStep
  • run Test Cases/main/TC2_failing
  • then you will see the following result:

The LogView shows that I got the last step failed. It meaned closeBrowser() failed!. But in fact, invocation of closeBrowser() was just working. The Log was just misleading. This must be a bug in Katalon Studio!

Katalon Studio 6.1.2.rc2 was announced: Katalon Studio version 6.1.2.rc2 with Settings support for custom keyword plugins

This version includes

I tried version 6.1.2 with the above mentioned case. I confirmed that the problem was fixed.

1 Like

わあ すごいですね ありがどう ございました


Thank you.

Please be advised, we are expected to write posts in English.

That’s true. I am a Chinese, working in a Japanese company which in china dalian.and my English is poor.i am very admire the English who can good learing.very glad you can reply me.Foreign friend! Exciting!

Wow, as a newbie to Katalon and groovy, this really excited me!!! Really really great job @kazurayam.
If I may ask, this is me being lazy:
Can one get intellisense \ autocomplete to pick up new methods and its parameters when you use metaClass to add custom methods?

I am not sure what you want.

I guess you want to know the signatures of methods of com.katalon.core.webui.keyword.WebUiBuiltInKeywords class. The most obvious way is to read the source code of the class. You can find the source code here:

If you want something more magical (you can do any by using Java Reflection mechanism), please describe what sort of problem you want to solve.

Hi @kazurayam,

I have added custom methods to WebUiBuiltInKeywords and also “extended” some methods by adding different signatures.
Now, all is well and the new methods are being executed correctly and works perfectly.
I just wanted to know if there is a way for intellisense to pick up the new methods. So, when a user types, the new methods should be displayed in the autocomplete suggestions.
Hope this makes sense

I don’t think it is possible.

The following StackOverflow thread gives us some idea how the autocomplete suggestions in Eclipse Java Editor works.

for this to work in the first place you need to include the javadoc jar files with the related jars in your project. Then when you do a Cntrl+Space it shows autocomplete and javadocs.

This tell us that the autocomplete of Eclipse Java Editor depends on the information provided by the javadoc jar files. The “autocomplete” shows, triggered by Ctrl+Press on editor, small fragments of javadoc. No more than javadoc.

The Groovy Metaprogramming artifacts do not produce any javadoc at all. I can not imagine what javadoc info of Groovy metaprogramming artifacts could be. I think that Groovy Metaprogramming and Java Editor’s autocomplete feature — these two would have no chance to get linked.

wow this is cool topic…
will it works at mobile testing ? for ex: hightlighting test object in android test or ios test ?

No. My code works only for WebUI testing over Selenium. Highlighting objects over Appium requires another work — I am not willing to.

Anybody who is skilled enough about Appium and Groovy programming will be able to make it. My code is as short as 70 lines, not big at all.

@kazurayam thank you very much for your code … it is a great contribution. But, I have a problem with the elements that are inside an iframe and / or frame. You will have some option for when there are objects to highlight within an iframe and / or frame. Try to modify your code, instead of WebUiCommonHelper.findWebElements use WebUiCommonHelper.findWebElementsWithSmartXPath but it did not help me. I hope you can help me.

You would need this:

My Keyword would need no change.

[quote=“sunil.saptal, post:57, topic:17408, full:true”]
hii @kazurayam,

currently after highlighting elements it is not clearing last selected elements highlighting, so screen gets reddish at that time.

is there any solution for after selecting element that should be clear while clicking on next element

Potentially yes but I am not willing to. Please try to make it yourself.

My intension why I made the ‘HighlightElement’ class was to demonstrate how Metaprogramming in Groovy language enable us to change the built-in behaviour of Katalon Studio rather than waiting for Katalon developers to hear and realise our wishes. I want to keep this “Metaprogramming sample code” as simple as possible.


Do you remember, you wrote at Jan '19

I updated my GitHub project

  1. Plugin jar which contains the HighlightElement class is now available. You can download it from the Releases page
  2. Previously only 6 WebUI keywords were marked “highlighting” and the coverage was fixed: , WebUI.selectOptionByIndex , WebUI.selectOptionByLabel , WebUI.selectOptionByValue , WebUI.setEncryptedText , WebUI.setText .
    As of ver 0.5.0, you can mark more WebUI keywords as highlighting. For example, verifyElementPresent, sendKeys, enhancedClick etc.

2 posts were split to a new topic: Outlining current Test Object/element