Issues when executing headless tests


So I have noted Issues when I am trying to executing some headless tests, they are:

  • Unable to set text in a specific text field using javascript i.e. getElementById(‘elementName’).value, this issue is particularly odd because I have set the text of many other fields that way in the same test case but it just fails on that particular field.

  • I get the following when my test case gets to the point of calling the getUrl() keyword in headless mode: 2019-03-16 13:42:36.801 ERROR c.k.k.core.keyword.internal.KeywordMain - ? Unable to get the url of the current window (Root cause: org.openqa.selenium.TimeoutException: timeout

Hey Gavin

Let us know which version of Katalon you’re using and share your code/errors, too. Take a look at this topic and follow the advice there:

1 Like

I’m using version 5.10.1.

This is code where it works on another field:

WebUI.clearText(findTestObject(‘Page_Create Motor Risk Item EpicAS/sum_insured_fld’))
WebUI.executeJavaScript(‘document.getElementById('ri_sum_insured').value = 3000000’, null)

This is the field that it doesn’t work on:

WebUI.clearText(findTestObject(‘Page_Gavin Bannister EpicASSURE/input_Amt. Received_receipt_it’), FailureHandling.STOP_ON_FAILURE)
WebUI.executeJavaScript(“document.querySelector(‘#receipt_item_amount_received_0’).value=50000”, null)

The error in the console doesn’t appear on the Javascript execution, it occurs when I do an assertion on an element that should have the contents of what I had set in the field. it doesn’t find the contents because it wasn’t set

Below is the bit of HTML for the field:

I have tried using the Send Keys to fix it, using what I found in this post:

For the getURL issue, see code and errors from console below:‘Claims/print_notif_slip’))
newUrl = WebUI.getUrl()
CustomKeywords.‘tools.readPDF.ReadPDF’(newUrl, “SLIP”)


com.kms.katalon.core.exception.StepFailedException: Unable to get the url of the current window (Root cause: org.openqa.selenium.TimeoutException: timeoute[0;39m
e[31m (Session info: headless chrome=72.0.3626.121)e[0;39m
e[31m (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)e[0;39m
e[31mCommand duration or timeout: 0 millisecondse[0;39m
e[31mBuild info: version: ‘3.7.1’, revision: ‘8a0099a’, time: '2017-11-06T21:07:36.161Z’e[0;39m
e[31mDriver info: com.kms.katalon.selenium.driver.CChromeDrivere[0;39m
e[31mCapabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.43.600210 (68dcf5eebde371…, userDataDir: …}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:50096}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 72.0.3626.121, webStorageEnabled: true}e[0;39m
e[31mSession ID: 577529aaf1182aa663271e6fe1f64c38)e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:36)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.builtin.GetUrlKeyword.getUrl(GetUrlKeyword.groovy:71)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.builtin.GetUrlKeyword.execute(GetUrlKeyword.groovy:66)e[0;39m
e[31m at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.getUrl(WebUiBuiltInKeywords.groovy:233)e[0;39m
e[31m at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$getUrl$ Source)e[0;39m
e[31m at 01 - Create - Create Claim:62)e[0;39m
e[31m at[0;39m
e[31m at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText([0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.runScript([0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.doExecute([0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase([0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase([0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.execute([0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase([0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase([0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain$runTestCase$ Source)e[0;39m
e[31m at[0;39m

[1552925280.031][SEVERE]: Timed out receiving message from renderer: 300.000
[1552925280.032][SEVERE]: Timed out receiving message from renderer: -0.001
[1552925581.050][SEVERE]: Timed out receiving message from renderer: 300.000
[1552925581.051][SEVERE]: Timed out receiving message from renderer: -0.001
2019-03-18 11:13:01.052 e[31mWARN e[0;39m e[36mc.k.k.c.w.h.s.WebUIScreenCaptor -e[0;39m e[39mCannot take screenshote[0;39m
2019-03-18 11:13:01.053 e[1;31mERRORe[0;39m e[36mc.k.k.core.keyword.internal.KeywordMain -e[0;39m e[31m❌ Unable to get the url of the current window

Also of note, the getURL is used in another headless test and it works fine

It’s looking like a chrome webdriver issue but what exactly is not obvious (for the reasons you mention - it works elsewhere).

@devalex88 @ThanhTo any ideas gentlemen?

Hi, the issue seems to have been raised in Selenium’s github:

Which cites the link to this issue:


Please match the information provided by users in the issue above against yours and see if updating Chromedriver to the latest version resolves the issue.

Regards !

1 Like

Thanks, will try and let you know the results

@ThanhTo Tried updating chromedriver, but the results are the same, even tried updating the selenium standalone server and the JRE for good measure

@Gavin_Bannister Hi, Im currently facing the same issue. Did you resolve it ?

1 Like

@Gavin_Bannister Hi, I encountered the same issue.

Hello, i found the solution on my case, but its a bit tricky, headless test is very fast on my case, so i need to check screenshot on some point of the test (making sure the test is on the right page).

i’m using these code to help me

String screenshotLocation = WebUI.takeScreenshot()
println screenshotLocation

and after i found the wrong parts, i added some delay before that part, and my testing working just fine

Hi, I am having this issue too. My test script works correctly when I run it through a regular Chrome browser, but doesn’t work with the headless Chrome. I tried updating the test driver a couple of times but nothing helps, it continues failing.