Katalon Recorder now supports extension scripts (AKA user-extensions.js)

We are happy to announce the support for extension scripts (AKA user-extensions.js) starting from Katalon Recorder 3.5.0. At this moment we allow custom locator builders and actions. We will maintain the compatibility with old Selenium IDE’s user-extensions.js to make it a drop-in replacement.

You can find complete documentation about this feature here https://docs.katalon.com/x/9APR.

6 Likes

Hi,

  We have a Selenium extension script that allows us to select using a custom locator (SmartClient). I have set up the script in the Katalon Recorder but I can't find a way to prioritise the locator in the Recorder. Is this possible?  

(I’m using chome 66 and I have restarted it before attempting to record)

Thanks
Dave

Thank you for the suggestion. There has been another request for this already. We will work on this very soon.

1 Like

Hi,
In Selenium we had a user-extensions file that used the following command:
this.browserbot.getUserWindow()
This doesn’t seem to work in Katalon Recorder. How can we access the same window object in the new extension scripts?
Thanks,
Mmn

@7578-MMN,

Due to the design of modern browsers’ extension platform, the access to window object is restricted.

You can use “runScript” command to run a JavaScript snippet inside the web page context, but then you won’t have access to “browserbot” APIs.

Hi I am new to Katalon but really like the new extension functionality. However I do not fully understand the example provided for locator builders. I would like to create a locator builder that returns an element based on a provided parameter. The element can be found using xpath, but I don’t want to repeat the same xpath over and over again. Is that possible with the Locator builder or any other extension function?
I also wonder if there is a neat way to include the extension functionality when exporting the test script?

Hi,

I am trying to add a new kind of locator, based on the example in the documentation.

LocatorBuilders.add(‘my super locator’, function(e) {
if (e.id) {
return “css=” + e.tagName + ‘#’ + e.id;
}
return null;
});

I have tried using this verbatim, and it works. However, I tried adding the following line before the if statement:
return “test”;

I did that just to see if it would output all locators as “test.” It didn’t. In fact, it did not use my locator at all, despite having made sure it was first in the order. It seems there is some sort of strange syntax requirement that is not mentioned in the documentation. What I am actually trying to do is generate an absolute css path, but it does not work when I use it to replace the current function content. I have tested it elsewhere, and it works.

Also, I’m assuming the locator is skipped if the function returns null, but that is not in the documentation. Either I am missing some documentation, or I think it needs to be touched up some.

Thank you! I hope there is an explanation soon, so that I can fix my solution.

3 Likes

Do you have any plans to support custom locators similar to how it was done in user-extensions.js in old Selenium IDE?