appium 執行的時候,偶爾會出現:[BaseDriver] Shutting down because we waited 1200 seconds for a command

Terry發表於2020-07-28

請教一下,自己在做appium的Android自動化測試的時候,跑到一半的時候,會有概率的出現[BaseDriver] Shutting down because we waited 1200 seconds for a command,然後導致session關閉,後面的測試都失敗。網上看的是是說什麼發給appium服務端的兩條命令間隔時間超過了60秒。導致session關閉被關閉。然後我仔細檢查了,我其實一直都在傳送appium命令,中間間隔就是幾秒,不可能會超過60秒。另外,desired_caps["newCommandTimeout"] = 1800;改成1800秒。也仍然會出現這個問題,已經摺騰了好久了,這個問題實在是解不出,希望大家幫我看一下
[debug] [35m[BaseDriver][39m Waited for 521 ms so far[debug] [35m[WD Proxy][39m Matched '/element' to command name 'findElement'
[debug] [35m[WD Proxy][39m Proxying [POST /element] to [POST http://localhost:8203/wd/hub/session/c972d964-b472-4d7a-9922-7081d2dc3412/element] with body: {"strategy":"-android uiautomator","selector":"new UiSelector().textContains(\"正在載入中...\")","context":"","multiple":false}
[info] [35m[WD Proxy][39m Got an unexpected response with status 404: {"sessionId":"c972d964-b472-4d7a-9922-7081d2dc3412","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:78)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.chann...
[debug] [35m[W3C][39m Matched W3C error code 'no such element' to NoSuchElementError
[debug] [35m[BaseDriver][39m Waited for 1033 ms so far[warn] [35m[BaseDriver][39m Shutting down because we waited 120 seconds for a command
[debug] [35m[UiAutomator2][39m Deleting UiAutomator2 session
[warn] [35m[Appium][39m Closing session, cause was 'New Command Timeout of 120 seconds expired. Try customizing the timeout using the 'newCommandTimeout' desired capability'
[info] [35m[Appium][39m Removing session 2fc7d4c7-7f6b-4657-96a3-765d1440b992 from our master session list
[debug] [35m[UiAutomator2][39m Deleting UiAutomator2 server session
[debug] [35m[WD Proxy][39m Matched '/' to command name 'deleteSession'
[debug] [35m[WD Proxy][39m Proxying [DELETE /] to [DELETE http://localhost:8202/wd/hub/session/7d434057-a217-4ffb-baee-f4844e7c6522] with no body
[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"7d434057-a217-4ffb-baee-f4844e7c6522","value":null}
[debug] [35m[ADB][39m Running 'E:\Terry\software\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:21523 shell am force-stop com.sf.trtms.driver'
[debug] [35m[Instrumentation][39m .
[debug] [35m[WD Proxy][39m Matched '/element' to command name 'findElement'
[debug] [35m[WD Proxy][39m Proxying [POST /element] to [POST http://localhost:8203/wd/hub/session/c972d964-b472-4d7a-9922-7081d2dc3412/element] with body: {"strategy":"-android uiautomator","selector":"new UiSelector().textContains(\"正在載入中...\")","context":"","multiple":false}
[info] [35m[WD Proxy][39m Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[debug] [35m[MJSONWP (4c5c56e0)][39m Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: socket hang up
[debug] [35m[MJSONWP (4c5c56e0)][39m at JWProxy.command (C:\Users\01393153\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:261:13)
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc/element [39m[31m500[39m [90m1537 ms - 250[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session/4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc/element[39m
[info] [35m[HTTP][39m [90m{"using":"id","value":"com.sf.trtms.driver:id/btn_operate","sessionId":"4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc"}[39m
[debug] [35m[MJSONWP (4c5c56e0)][39m Calling AppiumDriver.findElement() with args: ["id","com.sf.trtms.driver:id/btn_operate","4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc"]
[debug] [35m[BaseDriver][39m Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [35m[BaseDriver][39m Waiting up to 2000 ms for condition
[debug] [35m[WD Proxy][39m Matched '/element' to command name 'findElement'
[debug] [35m[WD Proxy][39m Proxying [POST /element] to [POST http://localhost:8203/wd/hub/session/c972d964-b472-4d7a-9922-7081d2dc3412/element] with body: {"strategy":"id","selector":"com.sf.trtms.driver:id/btn_operate","context":"","multiple":false}
[info] [35m[WD Proxy][39m Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[debug] [35m[MJSONWP (4c5c56e0)][39m Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: socket hang up
[debug] [35m[MJSONWP (4c5c56e0)][39m at JWProxy.command (C:\Users\01393153\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:261:13)
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc/element [39m[31m500[39m [90m5 ms - 250[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/session/4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc/screenshot[39m
[info] [35m[HTTP][39m [90m{}[39m
[debug] [35m[MJSONWP (4c5c56e0)][39m Calling AppiumDriver.getScreenshot() with args: ["4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc"]
[debug] [35m[WD Proxy][39m Matched '/screenshot' to command name 'getScreenshot'
[debug] [35m[WD Proxy][39m Proxying [GET /screenshot] to [GET http://localhost:8203/wd/hub/session/c972d964-b472-4d7a-9922-7081d2dc3412/screenshot] with no body
[info] [35m[WD Proxy][39m Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[debug] [35m[MJSONWP (4c5c56e0)][39m Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: socket hang up
[debug] [35m[MJSONWP (4c5c56e0)][39m at JWProxy.command (C:\Users\01393153\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:261:13)
[info] [35m[HTTP][39m [37m<-- GET /wd/hub/session/4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc/screenshot [39m[31m500[39m [90m9 ms - 250[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/session/4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc/appium/device/current_activity[39m
[info] [35m[HTTP][39m [90m{}[39m
[debug] [35m[MJSONWP (4c5c56e0)][39m Calling AppiumDriver.getCurrentActivity() with args: ["4c5c56e0-8ba7-429a-a3cd-0ab6e0f6eddc"]
[debug] [35m[ADB][39m Getting focused package and activity
[debug] [35m[ADB][39m Running 'E:\Terry\software\sdk\platform-tools\adb.exe -P 5037 -s 127.

相關文章