org.openqa.selenium.json.JsonException: Unable to determine type from: <. Last 1 characters read: <

Recently, I’ve been getting this intermittent issue to make my scripts failed. May I know if there is any resolution?

It only happened when run script with RemoteWebDriver on grid.

INFO: Katalon Version: 7.8.2

Caused by: com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: ‘<e.g.: detailed URL already provided here>’
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.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:61)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
at LoginToDEV12ApplicationFromTestCentral.run(LoginToDEV12ApplicationFromTestCentral:20)
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:394)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:385)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:364)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:356)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:251)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.doCall(CallTestCaseKeyword.groovy:59)
… 36 more
Caused by: org.openqa.selenium.json.JsonException: Unable to determine type from: <. Last 1 characters read: <
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘e.g:host’, ip: ‘10.162.180.62’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘2.6.18-194.11.1.el5’, java.version: ‘1.8.0_74’
Driver info: driver.version: EventFiringWebDriver
at org.openqa.selenium.json.JsonInput.peek(JsonInput.java:122)
at org.openqa.selenium.json.JsonTypeCoercer.lambda$null$6(JsonTypeCoercer.java:140)
at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:126)
at org.openqa.selenium.json.Json.toType(Json.java:69)
at org.openqa.selenium.json.Json.toType(Json.java:55)
at org.openqa.selenium.json.Json.toType(Json.java:50)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:87)
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.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at com.kms.katalon.selenium.driver.CRemoteWebDriver.execute(CRemoteWebDriver.java:30)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:277)
at org.openqa.selenium.support.events.EventFiringWebDriver.lambda$new$1(EventFiringWebDriver.java:105)
at com.sun.proxy.$Proxy13.get(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.get(EventFiringWebDriver.java:165)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.doCall(OpenBrowserKeyword.groovy:78)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.call(OpenBrowserKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 51 more

Similar issue:

After debugging on W3CHttpResponseCode#decode, it seems that the exception is thrown because the content of the response is not a JSON but a text/plain that only contains …

Hi @ti.wang01 , we are experiencing this same error, did you end up finding a solution to your problem?

@dlobban

Please share the console log and version of Studio, browser you are using

Hi @duyluong if you could have look at this issue for us that would be very much appreciated.

BACKGROUND:
The issue started happening 4 days ago on 30th May. We have been running this testing for months and have not had the issue before in that time.
We are using Katalon to run scripts in Browserstack on 8 different devices but only 2 of the devices are being effected. They are a DesktopPC/Windows 10/Chrome and DesktopPC/Windows 10/Edge.
We use a local connection to run the tests through.
Katalon Studio version = 8.3.5

ISSUE:
Randomly the test will fail on the step WebUI.verifyElementVisible or WebUI.waitForElementVisible and throw the following error:
“Caused by: org.openqa.selenium.json.JsonException: Unable to determine type from: <. Last 1 characters read: <”
It will randomly fail on one test but then pass when you re-run it, or in the test case I have attached where I am checking the same object on the same page 20 times in a row, it will fail in different positions each run or not fail at all.
It has failed across lots of different tests, test suites, and test objects/elements in the last 4 days.

THINGS WE HAVE TRIED:
The issue occurs when the test is run through Jenkins and when run from my laptop.
The Chrome and Edge browsers were updated in Browserstack on the 2nd and 5th May so we think that is NOT a factor.
Changing the Windows version from 10 to 11. This had no effect.
Changing the Selenium version that Browserstack uses. This may work but I have to do more testing.

Below are some screen shots that I hope will help but attached are the console logs, error log, and my TEST script for your information.

If you require any more information please do not hesitate to contact me.

Console Logs.txt (69.9 KB) Error log.txt (764.9 KB) TEST_ISSUE_Windows 10.txt (6.0 KB)