I’m trying to automate a loan application form, and I’m stuck on the very last step. The “Submit Loan” button is right there—I can see it perfectly fine on the page, it’s not hidden, and I don’t even have to scroll to find it.
But every time I run my script, it waits for a few seconds and then crashes with Element Not Interactable Exception. I tried using WebUI.waitFor ElementVisible, and the test passes that step, but as soon as it hits WebUI.click, it fails. I even tried adding a WebUI.delay(5) just to make sure the page was finished loading, but it still says it can’t interact with it.
Overlay/Shield: An invisible “loading” overlay or a transparent div is still sitting on top of the button.
Animation Lag: The button is fading in or sliding, and the WebDriver tries to click the exact coordinates before the animation finishes.
Overlapping Elements: The theme uses a custom wrapper that consumes the click event instead of the button itself.
The Solution: JavaScript Injection
When the standard Selenium click() (which WebUI.click uses) fails due to technical obstructions, the industry standard is to use a JavaScript Click. This bypasses the UI “physics” engine of the browser and sends the click command directly to the DOM element.
Custom Keyword Helper
I’ve drafted a custom keyword that combines a “Wait” strategy with a JavaScript click to ensure the button is pressed regardless of overlays or animation states.
Groovy
import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.common.WebUiCommonHelper
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import org.openqa.selenium.WebElement
import org.openqa.selenium.JavascriptExecutor
import com.kms.katalon.core.webui.driver.DriverFactory
class ActionHelper {
/**
* Force clicks an element using JavaScript to bypass ElementNotInteractableException
* @param to The Test Object to click
*/
@Keyword
def forceClick(TestObject to) {
try {
// 1. Wait for it to be present in the DOM
WebUI.waitForElementPresent(to, 5)
// 2. Convert TestObject to a real Selenium WebElement
WebElement element = WebUiCommonHelper.findWebElement(to, 5)
// 3. Use JavascriptExecutor to trigger the click event directly
JavascriptExecutor executor = (JavascriptExecutor) DriverFactory.getWebDriver()
executor.executeScript("arguments[0].click();", element)
println "Successfully force-clicked the element."
} catch (Exception e) {
WebUI.markFailed("Could not click the element: " + e.getMessage())
}
}
}
How to use it in your Script:
Replace your failing WebUI.click with this: CustomKeywords.'ActionHelper.forceClick'(findTestObject('Object Repository/Submit_Loan_Btn'))
Try wait for element clickable
WebUI.waitForElementClickable(findTestObject(‘path/to/SubmitLoanButton’), 10)
WebUI.click(findTestObject(‘path/to/SubmitLoanButton’))
If Katalon’s normal click() still fails, you can trigger the click via JS:
WebUI.executeJavaScript(“arguments[0].click();”, Arrays.asList(findTestObject(‘path/to/SubmitLoanButton’)))
If both above 2 don’t work then verify iFrame or Shadow DOM
first, swap waitForElementVisible for waitForElementClickable. Visible just means it’s rendered; clickable means WebDriver can actually interact with it, which is a higher bar. If that still times out, something is blocking the interaction.
open DevTools and inspect the button right before the click. Look for a transparent overlay, a loading spinner div, or a modal backdrop sitting on top of it. If you find one, wait for that blocker to disappear instead of using a blind delay.
if there’s genuinely no overlay and the element just won’t cooperate, use a JavaScript click as a workaround:
the JS click bypasses the browser’s interactability checks, so it works when the standard click cannot. Just know it also bypasses real user simulation, so use it only when the standard click is impossible.