Macaca switchFromNativeToWebView 报错

Larkin · 2017年06月07日 · 1506 次阅读
java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to com.alibaba.fastjson.JSONArray

    at macaca.client.commands.Context.getContexts(Context.java:27)
    at macaca.client.MacacaClient.contexts(MacacaClient.java:138)
    at macaca.java.biz.BaseMacacaClient.switchFromNativeToWebView(BaseMacacaClient.java:846)
    at com.mephisto.cases.AppLogin.LoginTest(AppLogin.java:38)
    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:100)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:646)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:811)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1137)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:749)
    at org.testng.TestRunner.run(TestRunner.java:603)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:368)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:363)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:321)
    at org.testng.SuiteRunner.run(SuiteRunner.java:270)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1284)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1209)
    at org.testng.TestNG.runSuites(TestNG.java:1124)
    at org.testng.TestNG.run(TestNG.java:1096)
    at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
    at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127)

qq20170601-163202

>> chromedriver bin path: /usr/local/lib/node_modules/macaca-android/node_modules/macaca-chromedriver/exec/chromedriver
>> Starting ChromeDriver 2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b) on port 9515
Only local connections are allowed.

>> chromedriver starting success.
>> proxy.js:52:14 [master] pid:53869 Proxy: /status:GET to http://localhost:9515/wd/hub/status:GET with body:
>> proxy.js:58:16 [master] pid:53869 Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Mac OS X\",\"version\":\"10.12.5\"}}}"
>> proxy.js:52:14 [master] pid:53869 Proxy: /session:POST to http://localhost:9515/wd/hub/session:POST with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.pingan.lifeinsurance.debug","androidUseRunningApp":true,"androidDeviceSerial":"038bbb51216a4010"}}}
>> proxy.js:58:16 [master] pid:53869 Got response with status 200: {"sessionId":"9ceb82ce42961ea673dd8d0268f704e3","status":33,"value":{"message":"session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\...
>> chromedriver ready with: {"sessionId":null,"status":33,"value":{"message":"session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\":{\"frameId\":\"11683.1\",\"isDefault\":true},\"id\":1,\"name\":\"\",\"origin\":\"https://www.test.pajk.cn\"}\n  (Session info: chrome=58.0.3029.83)\n  (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Mac OS X 10.12.5 x86_64)"}}
>> proxy.js:52:14 [master] pid:53869 Proxy: /wd/hub/session/:sessionId/window_handles:GET to http://localhost:9515/wd/hub/session/9ceb82ce42961ea673dd8d0268f704e3/window_handles:GET with body: {}
>> proxy.js:58:16 [master] pid:53869 Got response with status 200: {"sessionId":"9ceb82ce42961ea673dd8d0268f704e3","status":6,"value":{"message":"no such session\n  (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Mac OS X...
>> responseHandler.js:54:12 [master] pid:53869 Send Error Respone to Client: NoSuchDriver: no such session
  (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Mac OS X 10.12.5 x86_64)
>> responseHandler.js:60:14 [master] pid:53869 NoSuchDriver: no such session
  (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Mac OS X 10.12.5 x86_64)
    at Object._.parseWebDriverResult (/usr/local/lib/node_modules/macaca-android/lib/helper.js:72:11)
    at Android.getWebviews (/usr/local/lib/node_modules/macaca-android/lib/macaca-android.js:305:16)
    at Android.getWebviews.next (<anonymous>)
    at onFulfilled (/usr/local/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
    at process._tickCallback (internal/process/next_tick.js:109:7)
>> responseHandler.js:76:14 [master] pid:53869 Send Bad HTTP Respone to Client[2017-06-01 16:55:25]: {"sessionId":"f89543d3-4ba4-4195-906e-19bfc3d715ec","status":6,"value":{"message":"no such session\n  (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Mac OS X 10.12.5 x86_64)"}}
>> responseHandler.js:11:12 [master] pid:53869 Recieve HTTP Request from Client[2017-06-01 16:55:25]: method: DELETE url: /wd/hub/session/f89543d3-4ba4-4195-906e-19bfc3d715ec, jsonBody: {}
>> session.js:80:12 [master] pid:53869 Delete session, sessionId: f89543d3-4ba4-4195-906e-19bfc3d715ec
>> responseHandler.js:47:14 [master] pid:53869 Send HTTP Respone to Client[2017-06-01 16:55:25]: {"sessionId":"f89543d3-4ba4-4195-906e-19bfc3d715ec","status":0}
>> macaca-chromedriver.js:123:18 [master] pid:53869 chromedriver exit with code: null, signal: SIGTERM
共收到 0 条回复 时间 点赞
Larkin 关闭了讨论 06月20日 18:02
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册