Appium和量角器只是打开应用程序但无法对应用程序

时间:2017-07-03 07:42:38

标签: android selenium protractor appium

我使用appium和量角器开发了移动测试框架。当我调用conf文件时,它会打开应用程序但无法对应用程序执行任何操作。

Vesions:

Appium - 1.6.5 量角器 - 1.5.2

Appium错误日志

[HTTP] <-- POST /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1/timeouts 200 6 ms - 76 
[HTTP] --> GET /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1/screenshot {}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[JSONWP Proxy] Proxying [GET /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1/screenshot] to [GET http://127.0.0.1:8006/wd/hub/session/692285b1e372c578b360e9d1f60d9d36/screenshot] with body: {}
[HTTP] --> POST /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1/execute_async {"script":"try { return (function anonymous() {\nfunction getNg1Hooks(selector, injectorPlease) {\n  function tryEl(el) {\n    try {\n      if (!injectorPlease && angular.getTestability) {\n        var $$testability = angular.getTestability(el);\n        if ($$testability) {\n          return {$$testability: $$testability};\n        }\n      } else {\n        var $injector = angular.element(el).injector();\n        if ($injector) {\n          return {$injector: $injector};\n        }\n      }\n    } catch(err) {} \n  }\n  function trySelector(selector) {\n    var els = document.querySelectorAll(selector);\n    for (var i = 0; i < els.length; i++) {\n      var elHooks = tryEl(els[i]);\n      if (elHooks) {\n        return elHooks;\n      }\n    }\n  }\n\n  if (selector) {\n    return trySelector(selector);\n  } else if (window.__TESTABILITY__NG1_APP_ROOT_INJECTOR__) {\n    var $injector = window.__TESTABILITY__NG1_APP_ROOT_INJECTOR__;\n    var $$testability = null;\n    try {\n      $$t
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[HTTP] --> GET /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1/screenshot {}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[HTTP] --> DELETE /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1 {}
[MJSONWP] Calling AppiumDriver.deleteSession() with args: ["76ba62f0-93c3-4e77-9ce4-af6d35b841b1"]
[BaseDriver] Event 'quitSessionRequested' logged at 1499067418195 (13:06:58 GMT+0530 (IST))
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Stopping chromedriver for context WEBVIEW_com.volunteering.mobile
[Chromedriver] Changed state to 'stopping'
[JSONWP Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8006/wd/hub/session/692285b1e372c578b360e9d1f60d9d36] with no body
[MJSONWP] Encountered internal error running command: Error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: Error: ESOCKETTIMEDOUT
    at doJwpProxy$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/build/lib/mjsonwp/mjsonwp.js:563:15)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[MJSONWP] Encountered internal error running command: Error: Could not proxy. Proxy error: Cannot read property 'apply' of null
    at doJwpProxy$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/build/lib/mjsonwp/mjsonwp.js:563:15)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[MJSONWP] Encountered internal error running command: Error: Could not proxy. Proxy error: Cannot read property 'apply' of null
    at doJwpProxy$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/build/lib/mjsonwp/mjsonwp.js:563:15)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[HTTP] <-- GET /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1/screenshot 500 240025 ms - 281 
[HTTP] <-- POST /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1/execute_async 500 150019 ms - 237 
[HTTP] <-- GET /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1/screenshot 500 60028 ms - 237 
[Chromedriver] ProxyRequestError: Could not proxy command to remote server. Original error: Error: ESOCKETTIMEDOUT
    at JWProxy.proxy$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:144:11)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
 { ProxyRequestError: Could not proxy command to remote server. Original error: Error: ESOCKETTIMEDOUT
    at JWProxy.proxy$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:144:11)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
  jsonwp: 
   { Error: ESOCKETTIMEDOUT
       at ClientRequest. (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/request/request.js:819:19)
       at ClientRequest.g (events.js:286:16)
       at emitNone (events.js:86:13)
       at ClientRequest.emit (events.js:185:7)
       at Socket.emitTimeout (_http_client.js:614:10)
       at Socket.g (events.js:286:16)
       at emitNone (events.js:86:13)
       at Socket.emit (events.js:185:7)
       at Socket._onTimeout (net.js:334:8)
       at tryOnTimeout (timers.js:232:11)
       at Timer.listOnTimeout (timers.js:202:5) code: 'ESOCKETTIMEDOUT', connect: false } }
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/nextgen/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","HNB1DB0V","shell","am","force-stop","com.volunteering.mobile"]
[Chromedriver] [STDERR] [426.382][SEVERE]: Unable to receive message from renderer
[Chromedriver] [STDERR] [426.383][WARNING]: screenshot failed, retrying
[ADB] Pressing the HOME button
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/nextgen/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","HNB1DB0V","shell","input","keyevent",3]
[AndroidBootstrap] Sending command to android: {"cmd":"shutdown"}
[AndroidBootstrap] Received command result from bootstrap
[UiAutomator] Shutting down UiAutomator
[UiAutomator] Moving to state 'stopping'
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
[AndroidBootstrap] [UIAUTO STDOUT] close [socket][/127.0.0.1:4724]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=
[AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter=.
[AndroidBootstrap] [UIAUTO STDOUT] Time: 433.352
[AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1
[UiAutomator] UiAutomator shut down normally
[UiAutomator] Moving to state 'stopped'
[ADB] Attempting to kill all uiautomator processes
[ADB] Getting all processes with uiautomator
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/nextgen/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","HNB1DB0V","shell","ps"]
[ADB] No uiautomator process found to kill, continuing...
[UiAutomator] Moving to state 'stopped'
[Logcat] Stopping logcat capture
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/nextgen/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","HNB1DB0V","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[Appium] Removing session 76ba62f0-93c3-4e77-9ce4-af6d35b841b1 from our master session list
[BaseDriver] Event 'quitSessionFinished' logged at 1499067664534 (13:11:04 GMT+0530 (IST))
[MJSONWP] Received response: null
[MJSONWP] But deleting session, so not returning
[MJSONWP] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/76ba62f0-93c3-4e77-9ce4-af6d35b841b1 200 246339 ms - 76 

1 个答案:

答案 0 :(得分:1)

如评论中所述,屏幕截图可能会阻止。这可能与以下限制有关:

  • 或您的应用(您可以将此限制添加到您的(混合)应用)
  • 或者您只能在切换回NATIVE context
  • 时截取该应用的屏幕截图

您可以在日志记录的第二行找到屏幕截图的命令。这取决于日志记录的级别,但您也无法在屏幕截图调用中找到响应。这引发了我。