Skip to content

Switching back to webview - An unknown server-side error occurred - Original error: Unexpected token c in JSON at position 247  #259

Closed
@amitrparmar

Description

@amitrparmar

Description

I am getting an issue on iOS device when I switched to NATIVE view and try to back into Webview.

Environment

  • Appium server version: 1.8.0
  • MAC OS (Where appium runs): High Sierra 10.13.4
  • Desktop OS version: Windows 10
  • Mobile platform version: 10.3.3
  • Real device : iPAD 4

Details

AppiumDriver().getContextHandles();

APPIUM LOGs:

[HTTP] <-- GET /wd/hub/session/2b68dc2a-59d8-4925-bdd7-89d0ff51e90d/screenshot 200 2068 ms - 2024946
[HTTP]
[HTTP] --> GET /wd/hub/session/2b68dc2a-59d8-4925-bdd7-89d0ff51e90d/context
[HTTP] {}
[debug] [MJSONWP] Calling AppiumDriver.getCurrentContext() with args: ["2b68dc2a-59d8-4925-bdd7-89d0ff51e90d"]
[debug] [XCUITest] Executing command 'getCurrentContext'
[debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
[HTTP] <-- GET /wd/hub/session/2b68dc2a-59d8-4925-bdd7-89d0ff51e90d/context 200 2 ms - 84
[HTTP]
[HTTP] --> GET /wd/hub/session/2b68dc2a-59d8-4925-bdd7-89d0ff51e90d/contexts
[HTTP] {}
[debug] [MJSONWP] Calling AppiumDriver.getContexts() with args: ["2b68dc2a-59d8-4925-bdd7-89d0ff51e90d"]
[debug] [XCUITest] Executing command 'getContexts'
[debug] [iOS] Getting list of available contexts
[debug] [iOS] Retrieving contexts and views
[debug] [iOS] Selecting by url: false
[debug] [RemoteDebugger] Getting WebKitRemoteDebugger pageArray: localhost, 27753
[debug] [RemoteDebugger] Sending request to: http://localhost:27753/json
[MJSONWP] Encountered internal error running command: SyntaxError: Unexpected token c in JSON at position 247
[MJSONWP] at JSON.parse ()
[MJSONWP] at WebKitRemoteDebugger.getJsonFromUrl$ (/usr/local/lib/node_modules/appium/node_modules/appium-remote-debugger/lib/webkit-remote-debugger.js:85:22)
[MJSONWP] at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[MJSONWP] at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[MJSONWP] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[MJSONWP] at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[MJSONWP] at
[HTTP] <-- GET /wd/hub/session/2b68dc2a-59d8-4925-bdd7-89d0ff51e90d/contexts 500 7 ms - 213

Java Client Error

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unexpected token c in JSON at position 247 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 16 milliseconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'COMPUTER000117', ip: '192.168.133.60', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities [{app=/Users/admin/Desktop/IPA/TouchClassic_5.0.1.app, networkConnectionEnabled=false, databaseEnabled=false, deviceName=ipad, fullReset=true, platform=MAC, showXcodeLog=true, newCommandTimeout=300, platformVersion=10.3.1, webStorageEnabled=false, locationContextEnabled=false, automationName=XCUITest, browserName=, takesScreenshot=true, javascriptEnabled=true, platformName=iOS, udid=d8a8f24c27769d00627929f291b15eb015e9e8c4, autoAcceptAlerts=true}]
Session ID: 2b68dc2a-59d8-4925-bdd7-89d0ff51e90d

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:235)
at io.appium.java_client.AppiumDriver.getContextHandles(AppiumDriver.java:562)

Requesting JSON url

I'm getting below JSON while hitting http://localhost:27753/json URL.

[{
  "devtoolsFrontendUrl": "/devtools/devtools.html?ws=192.168.134.46:27753/devtools/page/8",
  "faviconUrl": "",
  "thumbnailUrl": "/thumb/http://192.168.134.212/touchcg/?device=ios&sftouch=1&secure=1#pages/callscalendar/{"loadTime"%3A"3322"}",
  "title": "Consumer Goods 12.20",
  "url": "http://192.168.134.212/touchcg/?device=ios&sftouch=1&secure=1#pages/callscalendar/{"loadTime"%3A"3322"}",
  "webSocketDebuggerUrl": "ws://192.168.134.46:27753/devtools/page/8",
  "appId": "PID:322"
}]

Error

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unexpected token l in JSON at position 223 (WARNING: The server did not provide any stacktrace information)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions