Cannot get Katalon/Selenium to locate button in iframe in Chrome

I’m facing an infuriating problem with a basic test of our website, where we need to click a button in a modal pop-up in an iframe. This is a test we’ve had running successfully for many months, but it started failing (though only on Chrome, while FF still works) on the 4th of june.

To reproduce the error/problem, record a new test-case in Katalon Studio 7.5.5.1 using the Record Web functionality:

  1. Navigate to https:/ekstrabladet.dk
  2. Click on the OK button in the modal pop-up
  3. End the Record Web session and save as a test case (T1).

Executing T1 on Firefox (77.0.1 64bit MacOS) will succeed.
Executing T1 on Chrome (83.0.4103.97 64bit MacOS) will fail.

Chrome log viewer:

Caused by: org.openqa.selenium.WebDriverException: unknown error: call function result must be a dictionary
================================================

06-08-2020 03:19:33 PM click(findTestObject("Object Repository/RECREATED/Page_Nyheder sport og underholdning/button_OK"))

Elapsed time: 1,413s

Unable to click on object 'Object Repository/RECREATED/Page_Nyheder sport og underholdning/button_OK' (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object 'Object Repository/RECREATED/Page_Nyheder sport og underholdning/button_OK'
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:76)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$1.call(Unknown Source)
	at ClickOK.run(ClickOK:24)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:169)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:142)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:91)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1591622367475.run(TempTestSuite1591622367475.groovy:37)
Caused by: org.openqa.selenium.WebDriverException: unknown error: call function result must be a dictionary
  (Session info: chrome=83.0.4103.97)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'mac20891', ip: 'fe80:0:0:0:c51:1ae:fa3b:5d6b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.5', java.version: '1.8.0_181'
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.97, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: /var/folders/60/72ps4vsn1wg...}, goog:chromeOptions: {debuggerAddress: localhost:51952}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
Session ID: 61053a43c3ce0610896f38fbeb3c902e
*** Element info: {Using=xpath, value=//*[(text() = 'OK' or . = 'OK')]}
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19)
	at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:353)
	at org.openqa.selenium.remote.RemoteWebDriver.findElementsByXPath(RemoteWebDriver.java:432)
	at org.openqa.selenium.By$ByXPath.findElements(By.java:348)
	at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:311)
	at org.openqa.selenium.support.events.EventFiringWebDriver.lambda$new$1(EventFiringWebDriver.java:105)
	at com.sun.proxy.$Proxy10.findElements(Unknown Source)
	at org.openqa.selenium.support.events.EventFiringWebDriver.findElements(EventFiringWebDriver.java:182)
	at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElements(WebUiCommonHelper.java:789)
	at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1150)
	at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.findWebElement(WebUIAbstractKeyword.groovy:27)
	at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.findWebElement(WebUIAbstractKeyword.groovy:26)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:67)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:76)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$1.call(Unknown Source)
	at Script1591621560920.run(Script1591621560920.groovy:24)
	... 13 more
)

I’m stumped as to why this test works on Firefox, but not (anymore) on Chrome. Any hint/advice would be very welcome.

Maybe use WebUI.delay(1) before click. Or WebUI.waitForElementPresent(findTestObject(‘your_iframe’), 5).
I have same kind of problems, and those helped with them.

1 Like

Thanks for your response and suggestion Ilkka.
Unfortunately, the result is unchanged. I still get the “unknown error: call function result must be a dictionary”, and only in Chrome.

@oyvind.mo
You may try with enhanced click keyword: https://docs.katalon.com/katalon-studio/docs/webui-enhanced-click.html

1 Like

Thanks duyluong, I tried using Enhanced Click, but unfortunately with the same result.

It seems that the problem is for Chrome to locate the element (a specific button within an iframe). Similar
keywords like Wait For Element Visible and Wait For Element Clickable also fail in Chrome with the “unknown error: call function result must be a dictionary”.