Iframe issue on katalon

How do we deal with the situation where the web element is in a frame - which is within an iFrame
When do ‘SwitchtoFrame’ - do we have to use the keyword for iFrame/Frame or both? I tried all 3 possibilities but it seems to not able to find the iFrame using any xpath/attruibutes.

Any thoughts?

Hi @anishas,
Remove the 5 second Delay.
Change the ‘Switch To Frame - frame_Contribution Receivables’ to 30 seconds or more.
Remove the second ‘Switch To Frame - frame’
Retry the test.

Alternatively this might help…
Create your self a new test object
Right click on Object Repository > New > Test Object
Create ‘testIframe’ for example

Click on the ‘Xpath’ tab and set the value to //iframe or (//iframe)[1] or (//iframe)[2] if you have 2 iframes, save the object.

Add the following to the test case body:

// Switches to iframe
WebUI.switchToFrame(findTestObject('Object Repository/testIframe'), 90)
// Your code ...
// Switches from iframe

This link may help too: How to (manually) work with iframes in Katalon

Hi I will rephrase - my object (New Invoice button) is within a Frame (which is within the iFrame)

When I use the Object Spy - it identifies the object and iframe correctly
For the iFrame_Contribution Receivables - I cannot use the xpath ID (ext-gen5877) as a locator since the value changes with every run
And there is a frame within the iframe

So I have to SwitchTo ‘iFrame’ or ‘Frame’?
Why Katalon cannot find the Frame or iFrame?

Hi @anishas,
This might help you…
Update your ‘Iframe_Contribution_Receivables’ object as follows: You might need to play with the values.

This might help too:

Body of your test case:

// Waits up-to 10 seconds to switch to iframe (increase wait time if needed).
WebUI.switchToFrame(findTestObject('Object Repository/Iframe_Contribution_Receivables'), 10)
// Your code goes here ...
WebUI.waitForElementPresent(findTestObject('Object Repository/NewInvoiceBtn'), 10)
WebUI.enhancedClick(findTestObject('Object Repository/NewInvoiceBtn'))
// Switches from iframe to main page