Can't properly capture and identify objects in an iframe

Hello all,

I recently started a new job and thus new project. I suggested Katalon as a new tool for test automation and my boss gave the go to try it out.

Going through my first script i ran into a big problem - the software to test uses iframes, and i can’t seem to make them work with Katalon.

While recording or using the Object Spy i can capture the objects inside the iframe, but then during execution of the test, or when using “Verify and highlight” Katalon fails to detect and identify the objects.

I did some research here, read a few threads on the forum but neither solved my problem. I referred to for help but for some reason the interface of my object spy is nothing like the one shown in this guide. I am using Katalon 5.4.2 Build 1.

FYI, when using the Katalon Automation plugin for Chrome i can record and run my script, but when imported to Katalon studio it fails to identify the iframe objects again.

I can provide some code or screenshots if needed. This is very important, please if you know how to solve such an issue, let me know!

Hi, Dobromir

I recommend using the script mode instead of the Object Spy, and xpath and css selectors for identifying your objects. It is much less flaky than recording and replaying. But, I guess it’s ok if you are just getting used to KS.

As far as the iframe issue: what I found useful was checking off the ‘Have parent object?’ (btw, @Katalon Studio, should this be ‘Has parent object?’) in the settings of your object in the repository:

and, of course, switching to iframe before interacting with an object inside of the frame. You just add the WebUI.switchToFrame(findTestObject(‘ifr_yourFrame’), 5), where ‘ifr_yourFrame’ is the identifier of the iframe, either written by you, or recorded via the Object Spy.


1 Like

Hello Mate,

thank you for the input!

I seem to have solved the issue by actually DE-selecting the “parent” option of the object and manually doing “switchToFrame”, as suggested by you, then clicking the object inside the iframe by just it’s id. So far it worked for 1 object, i’ll see how it goes for the rest of the script.

What’s weird is that if you do select “Parent iframe” for an object, there’s a reference to the parent added to the identifier of the object and Katalon adds a “switch to frame” automatically during the object detection process. But that part doesn’t work, atleast for me.

Anyone else having such problems?

P.S. Why isn’t my Object Spy interface like the one seen in the help page?

I am having similar problem, katalon doesn’t identify an object within iFrame. This is xPath captured for iframe (.//*[normalize-space(text()) and normalize-space(.)=‘Login’])[1]/following::iframe[1] and there’s an object to enter email within iframe with xPath as //input[@id=‘UserName’]. And I tried both switching focus on iframe first and then click and enter username but still it doesn’t work.