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

11.4k Views Asked by At

The getDriver() function returns an instance of iOS Driver. I am getting the below error when trying to reset the app using the below command,

Driver.getDriver().resetApp();

I also tried replacing this command with closeApp and launchApp as below. But that is also failing with the same error.

Driver.getDriver().closeApp();
Driver.getDriver().launchApp();

The error is not very informative and I am not sure how to fix this error as well. Can someone please help me on the same please?

Unable to determine type from: Y. Last 1 characters read: Y
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Kishores-MBP', ip: 'fe80:0:0:0:35:43cd:351c:edd3%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_231'
Driver info: driver.version: IOSDriver
org.openqa.selenium.json.JsonException: Unable to determine type from: Y. Last 1 characters read: Y
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Kishores-MBP', ip: 'fe80:0:0:0:35:43cd:351c:edd3%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_231'
Driver info: driver.version: IOSDriver
    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 io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:45)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
    at io.appium.java_client.InteractsWithApps.resetApp(InteractsWithApps.java:93)
    at hid.seos.testCases.ui.ListEventsForEndpoint.initialise(ListEventsForEndpoint.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:63)
    at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:348)
    at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:302)
    at org.testng.internal.TestInvoker.runConfigMethods(TestInvoker.java:695)
    at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:523)
    at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
    at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
    at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
    at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at org.testng.TestRunner.privateRun(TestRunner.java:766)
    at org.testng.TestRunner.run(TestRunner.java:587)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
    at org.testng.SuiteRunner.access$000(SuiteRunner.java:28)
    at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:425)
    at org.testng.internal.thread.ThreadUtil.lambda$execute$0(ThreadUtil.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
2

There are 2 best solutions below

0
On BEST ANSWER

Just figured out the root cause for the exception. It took me long enough, because the error message was not that much helpful.

Root Cause: I was using pcloudy for Appium, and I just missed the line for mentioning the platformVersion in pcloudyDesiredCapabilities. So if anyone else is facing the same issue, just make sure that you are not missing anything in the DesiredCapabilities part when you are initializing the Webdriver(AndroidDriver or IOSDriver).

0
On

today I had the same error when I was opening the URL (https://google.com) but after spending time trying to figured what was happen, I realized than the problem was triggered by the firewall where the selenium grid is hosted, so may the problem could be the access from the selenium grid the the URL what you want test. This is my poor experience and I hope help to you in your project.