Advice for Element Not Interactable Exception for offscreen objects?

I am looking for any advice with how to deal an object that is off screen and Katalon does not want to find it, although it runs perfectly fine using other automation applications such as Playwright.

The application that I am testing is too big for the screen when launched by Katalon and resizing it with javascript breaks coordinates and results in the same error, or depending on the object with zoom changed will throw an object intercepted error, but ultimately Katalon cannot find the object:

…Reason: org.openqa.selenium.ElementNotInteractableException: element not interactable…

I have tried to use the wait for visible command and the like and have looked at the tips section of Katalon as suggested in other posts with similar issues and have not been able to solve this issue.

I have tested this process using Playwright in VS Code and it processes clicking the buttons off screen with 0 issues, so this is clearly possible, just not with Katalon?

WebUI.openBrowser(ā€˜URL’)

WebUI.delay(1)

WebDriver driver = DriverFactory.getWebDriver()

def testObj = driver.findElement(By.xpath(ā€œ//*[@navlinkid = ā€˜0’]ā€))

KeywordUtil.logInfo(testObj.getText())

testObj.click()

1 Like

Hi @leishman_keith,
Using a ClickUsingJava keyword or WebUI.enhancedClick(findTestObject('yourObject')) might work you…

You can try using WebUI.enhancedClick(findTestObject('yourObject')) or the following:

First create a custom keyword as follows:

package tools
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement
import org.openqa.selenium.interactions.Actions as Actions
import com.kms.katalon.core.annotation.Keyword as Keyword
import com.kms.katalon.core.testobject.TestObject as TestObject
import org.openqa.selenium.JavascriptExecutor as JavascriptExecutor
import com.kms.katalon.core.webui.common.WebUiCommonHelper as WebUiCommonHelper
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory

public class ClickUsingJava {
	@Keyword
	def clickUsingJS(TestObject to, int timeout)
	{
		WebDriver driver = DriverFactory.getWebDriver()
		WebElement element = WebUiCommonHelper.findWebElement(to, timeout)
		JavascriptExecutor executor = ((driver) as JavascriptExecutor)
		executor.executeScript('arguments[0].click()', element)
	}
}

Next call the keyword in your test case:

CustomKeywords.'tools.ClickUsingJava.clickUsingJS'(findTestObject('yourObject'), 30)

enhancedClick seems to be working for this…Thank You!

1 Like