Issues when executing headless tests


#1

Hi,

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


#2

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:


#3

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.delay(1)
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.delay(5)
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: https://forum.katalon.com/t/element-not-interactable-in-chrome-headless/19718

For the getURL issue, see code and errors from console below:

WebUI.click(findTestObject(‘Claims/print_notif_slip’))
WebUI.delay(15)
WebUI.switchToWindowIndex(1)
newUrl = WebUI.getUrl()
CustomKeywords.‘tools.readPDF.ReadPDF’(newUrl, “SLIP”)

Console:

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$9.call(Unknown Source)e[0;39m
e[31m at 01 - Create Claim.run(01 - Create Claim:62)e[0;39m
e[31m at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)e[0;39m
e[31m at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:328)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:319)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:298)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:290)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:224)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:106)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:97)e[0;39m
e[31m at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)e[0;39m
e[31m at TempTestCase1552844547878.run(TempTestCase1552844547878.groovy:22)e[0;39m


#4

[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


#5

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?


#6

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

Which cites the link to this issue:

https://bugs.chromium.org/p/chromedriver/issues/detail?id=2239

@Gavin_Bannister

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 !


#7

Thanks, will try and let you know the results


#8

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