Katalon can't find iFrame

Hi, I’ve recently had an issue where Katalon sometimes can’t find a specific iFrame. This usually results in the test failing with the error:

[FAILED] - Test Cases/check_test FAILED because (of) Unable to verify object ‘Object Repository/iFrames/WebGL_Frame’ is present (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/iFrames/WebGL_Frame’ located by ‘By.xpath: //iframe[@id = ‘webgl_frame’ and @name = ‘webgl_frame’]’ not found)

this has been confusing me, because when I check manually, or with web spy, the iFrame is clearly there, and should be matched by the given criteria. This seems to vary between servers (even if they’re running more or less the same code), but I can’t think of any changes that should affect the iFrame, which appears the same on all servers.

can anyone think of any setting or issues on either Katalon or in general server settings that might cause this issue?

2 Likes

Harrison Pringle said:

Hi, I’ve recently had an issue where Katalon sometimes can’t find a specific iFrame. This usually results in the test failing with the error:

[FAILED] - Test Cases/check_test FAILED because (of) Unable to verify object ‘Object Repository/iFrames/WebGL_Frame’ is present (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/iFrames/WebGL_Frame’ located by ‘By.xpath: //iframe[@id = ‘webgl_frame’ and @name = ‘webgl_frame’]’ not found)

this has been confusing me, because when I check manually, or with web spy, the iFrame is clearly there, and should be matched by the given criteria. This seems to vary between servers (even if they’re running more or less the same code), but I can’t think of any changes that should affect the iFrame, which appears the same on all servers.

can anyone think of any setting or issues on either Katalon or in general server settings that might cause this issue?

I am also facing the same issue

Hi Pooja (and Harrison if you’re still around)

If this is a “sometimes” issue, then that to me implies a timing problem – sometimes the iframe is loaded and ready to work with and sometimes not… did you try using a lengthy timeout, like 20 or 30 seconds? (Understand that KS will not necessarily wait that long, it will succeed as soon as it can within that timeout period).

Russ

Hi Russ

Could you please help? I’m facing the same issue too.

For me, the test failed when it goes through a for loop statement.

So i have a test case which uses CSV data and contains a for loop.

First iteration it passed, the frame was found when waiting for element present/ visible (with timeout 30-60 seconds) and switching to frame was successful.

But when it goes to second iteration, frame is not found causing the test case failed.

It worked well before on katalon studio version 5.4.0, my test case can run the loop smoothly.

But when there’s an update, my test case suddenly failed because of this frame issue.

I would appreciate your help. Thank you

Hi Sion

That sounds like a bug in 5.4.1 (I assume that is what you’re using?).

Understand that “Katalon Expert”, while an honor, is essentially meaningless – I’ve only used KS since late February and whatever is going on there, is beyond my capabilities to help.

Post a bug. Tell them I sent you B) I promise it will have no effect at all :smiley:

Russ

Hi Russ
Oh I see… haha
Thank you anyway for replying… :slight_smile:

Two gotcha’s:

  1. Here is a fix on the default Katalon recorded Detect object by behavior for iframe objects.

After recording, drill down on the Object Repository. Find your “page container” and then, double click on each of your iframe_XXXX objects in order to pull up the object Settings work panel. Now toggle off any Detect object by values that may have dynamic values in the Value column, and instead enable the xpath option.

So the gotcha may be that the recorder recorded a Detect object by attribute that had a dynamic value in it that has since changed - tests will never Detect object and will always fail with a timeout. So the Detect Object by xpath version works for me 100% and is a cleaner basic option. In my case I toggled off the src attribute and enabled the xpath line…voila, c’est prêt.

Of course your could go to the script api and programatically handle those dynamic attribute lookups with regex, but in my case the xpath line was all I needed to simply load the iframe object (dialog box).

  1. Is it just me or was the re-enabling the Tests Explorer window view completely non intuitive…the Reset Perspective does not work from Debug perspective back to get back to the Katalon Tests Explorer view…restarting does eh hem hem. However clicking the Keyword button there beside that default toolboar and Debug button does load back the Tests Explorer…hmmm.

Cheers,
djm

If you check the object repo and the element does match for the page requested, try this:

Works for me…

import com.kms.katalon.core.webui.driver.DriverFactory

import org.openqa.selenium.WebDriver

WebDriver driver = DriverFactory.getWebDriver()

driver.switchTo().defaultContent()

1 Like

I used switch to default content, then switch to frame, gave a delay for the frame to load but dint work