Testing failed because of multiple hidden iFrames on the page

I am new to the Katalon studio. Having issue with Hidden iFrames on checkout page.
I have used following method to avoid this issue but still it is not resolved.

//Add to the imports section for use with “driver.switchTo().frame(0)”
import org.openqa.selenium.WebDriver as WebDriver
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory

//Input the following anywhere in the body of your test case
WebUI.delay(5)
WebDriver driver = DriverFactory.getWebDriver()
driver.switchTo().frame(0)

//When finished working in the iframe switch back to default content
WebUI.switchToDefaultContent

This is the Error message I got :

Caused by: org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element is not clickable at point (881, 626). Other element would receive the click:

This is my script :

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject

import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint

import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import com.kms.katalon.core.model.FailureHandling as FailureHandling

import com.kms.katalon.core.testcase.TestCase as TestCase

import com.kms.katalon.core.testdata.TestData as TestData

import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW

import com.kms.katalon.core.testobject.TestObject as TestObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

import internal.GlobalVariable as GlobalVariable

import org.openqa.selenium.Keys as Keys

//Add to the imports section for use with “driver.switchTo().frame(0)”

import org.openqa.selenium.WebDriver as WebDriver

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

WebUI.openBrowser(‘’)

WebUI.navigateToUrl(GlobalVariable.URL)

WebUI.click(findTestObject(‘Object Repository/Page_Quebecs largest distributor of electri_502989/button_Accept All’))

CustomKeywords.‘MyKeywords.B2Blogin’()

CustomKeywords.‘MyKeywords.ChangeUser’()

WebUI.click(findTestObject(‘Object Repository/B2B_Checkout/Page_B2B Quebecs largest distributor of el_3fb5b3/a_level1’))

WebUI.click(findTestObject(‘Object Repository/B2B_Checkout/Page_B2B Quebecs largest distributor of el_3fb5b3/a_Lighting’))

WebUI.click(findTestObject(‘Object Repository/B2B_Checkout/Page_Lighting/button_ADD TO CART’))

WebUI.click(findTestObject(‘Object Repository/B2B_Checkout/Page_Lighting/i_fe fe-shopping-cart’))

WebUI.delay(5)

WebUI.click(findTestObject(‘Object Repository/B2B_Checkout/Page_Shopping Cart/span_Delivery’))

WebUI.selectOptionByValue(findTestObject(‘Object Repository/B2B_Checkout/Page_Shopping Cart/select_shipTo’), ‘’, true)

WebUI.delay(5)

WebDriver driver = DriverFactory.getWebDriver()

driver.switchTo().frame(4)

WebUI.switchToDefaultContent()

WebUI.delay(5)

WebUI.click(findTestObject(‘Object Repository/B2B_Checkout/Page_Shopping Cart/input_checkout-btn’))

WebUI.click(findTestObject(‘Object Repository/B2B_Checkout/Page_Checkout/input_Review Order’))

WebUI.click(findTestObject(‘Object Repository/B2B_Checkout/Page_Checkout/input_Submit Order’))

1 Like

Hi there, and thanks for posting in the Katalon community! :hugs:

To help you faster, please review our guide on Custom Keyword here: Introduction to custom keywords in Katalon Studio | Katalon Docs. Double-checking the steps and configurations might resolve the issue.

If the doc doesn’t help, feel free to provide more details, and a community member will assist you soon. Thanks for being a part of our community!

Best,
Elly Tran

To resolve the issue with hidden iFrames in your checkout page, follow these structured steps:

1. Identify the Correct iFrame

  • Use browser developer tools (F12) to inspect the page and determine the correct iFrame index, name, or ID where your target element resides.
  • Avoid relying on indices (e.g., frame(4)) as they can change. Prefer stable identifiers like name or id.

2. Switch to the iFrame Properly

  • Use Katalon’s built-in WebUI.switchToFrame() instead of raw WebDriver commands for better compatibility.
  • Example:

groovy

WebUI.switchToFrame(findTestObject('iFrame_Object'), 10) // Wait up to 10 seconds for the frame

3. Avoid Prematurely Exiting the Frame

  • Remove WebUI.switchToDefaultContent() immediately after switching frames. Perform interactions within the frame first.

groovy

WebUI.delay(5)
WebUI.switchToFrame(2) // Switch to the correct frame index/identifier
WebUI.click(findTestObject('Object_Inside_Frame')) // Perform actions here
WebUI.switchToDefaultContent() // Exit only after completing actions

4. Use Explicit Waits Instead of Fixed Delays

  • Replace WebUI.delay(5) with WebUI.waitForElementClickable to handle dynamic content reliably.

groovy

WebUI.waitForElementClickable(findTestObject('Object_Inside_Frame'), 10)

5. Check for Overlapping Elements

  • Ensure no popups, banners, or other elements (e.g., cookies consent) are blocking the target element. Close them first:

groovy

if (WebUI.verifyElementPresent(findTestObject('Popup_Close_Button'), 5)) {
  WebUI.click(findTestObject('Popup_Close_Button'))
}

6. Handle Nested iFrames

  • If the element is inside nested iFrames, switch to each parent frame sequentially:

groovy

WebUI.switchToFrame('parentFrame')
WebUI.switchToFrame('childFrame')

Revised Script Example:

groovy

// ... Your existing code ...

// Wait for the frame and switch to it
WebUI.waitForElementPresent(findTestObject('iFrame_Selector'), 10)
WebUI.switchToFrame(findTestObject('iFrame_Selector'), 10)

// Click the element within the frame
WebUI.waitForElementClickable(findTestObject('Object_Inside_Frame'), 10)
WebUI.click(findTestObject('Object_Inside_Frame'))

// Switch back to default content after interaction
WebUI.switchToDefaultContent()

// Proceed with other actions
WebUI.click(findTestObject('Page_Checkout/input_Submit_Order'))

Key Takeaways:

  • Avoid Index-Based Switching: Use identifiers like name or id for frames.
  • Explicit Waits: Replace delay() with waitForElementClickable.
  • Frame Context: Ensure you’re in the correct frame context before interacting with elements.
  • Overlays: Check for and close any blocking elements.

If the issue persists, share the HTML structure of the iFrames

The following Stackoverflow post suggests several countermeasures you could try:

https://stackoverflow.com/questions/62260511/org-openqa-selenium-elementclickinterceptedexception-element-click-intercepted