appium / appium-windows-driver

Appium's interface to WindowsAppDriver provided by Microsoft
Apache License 2.0
125 stars 35 forks source link

Appium is not connecting WinAppDriver and instead of keep alive connection I am having close status ([WinAppDriver] [STDOUT] Connection: close) #49

Open Kmran opened 5 years ago

Kmran commented 5 years ago

The problem

I have to execute tests against UWP application and I am using Appium latest version with WinAppDriver 1.1 version. When I execute my scripts by only running WinAppDriver then I am successfully able to see the connection of WinAppDriver as "Keep Alive" but when I try to execute it through Appium then I am unable to make WinAppDriver connection as Keep Alive and I am seeing close. so can some one please suggest what the issue is ?

Environment

Details

unable to make connection with WinAppDriver by using Appium.

When I run my scripts directly on WinAppDriver 1.1 vesion I have the following status of connection as keep Alive

POST /wd/hub/session HTTP/1.1 Accept: application/json, image/png Connection: Keep-Alive Content-Length: 242 Content-Type: application/json;charset=utf-8 Host: 127.0.0.1:4723 User-Agent: selenium/3.141.0 (.net windows)

but when I run with Appium I have the following status of connection as close

[WinAppDriver] [STDOUT] Press ENTER to exit. [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] ========================================== [WinAppDriver] [STDOUT] GET /wd/hub/status HTTP/1.1 [WinAppDriver] [STDOUT] Accept: application/json, / [WinAppDriver] [STDOUT] Connection: close [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [WinAppDriver] [STDOUT] User-Agent: appium [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] HTTP/1.1 200 OK [WinAppDriver] [STDOUT] Content-Length: 147 [WinAppDriver] [STDOUT] Content-Type: application/json

Link to Appium logs

The server is running [Appium] Welcome to Appium v1.12.1 [Appium] Appium REST http interface listener started on 0.0.0.0:4723 [HTTP] --> POST /wd/hub/session [HTTP] {"desiredCapabilities":{"platformName":"Windows","app":"D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe","deviceName":"WindowsPC","newCommandTimeout":300},"capabilities":{"firstMatch":[{"platformName":"Windows"}]}} [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"Windows","app":"D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe","deviceName":"WindowsPC","newCommandTimeout":300},null,{"firstMatch":[{"platformName":"Windows"}]}] [BaseDriver] Event 'newSessionRequested' logged at 1554887647899 (14:14:07 GMT+0500 (Pakistan Standard Time)) [Appium] Could not parse W3C capabilities: 'deviceName' can't be blank [Appium] Trying to fix W3C capabilities by merging them with JSONWP caps [BaseDriver] The capabilities ["app","deviceName","newCommandTimeout"] are not standard capabilities and should have an extension prefix [Appium] Appium v1.12.1 creating new WindowsDriver (v1.5.1) session [Appium] Capabilities: [Appium] app: D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe [Appium] deviceName: WindowsPC [Appium] newCommandTimeout: 300 [Appium] platformName: Windows [BaseDriver] Creating session with MJSONWP desired capabilities: {"platformName":"Windows","... [BaseDriver] The following capabilities were provided, but are not recognized by appium: app. [BaseDriver] Session created with session id: 10d04ed1-1aaf-425c-8df2-8113e8973b84 [WinAppDriver] You must use WinAppDriver version 1.1 [WinAppDriver] Verifying WinAppDriver version 1.1 is installed via comparing the checksum. [WinAppDriver] WinAppDriver changed state to 'starting' [WinAppDriver] Killing any old WinAppDrivers on same port, running: FOR /F "usebackq tokens=5" %a in (netstat -nao ^| findstr /R /C:"4724 ") do (FOR /F "usebackq" %b in (TASKLIST /FI "PID eq %a" ^| findstr /I winappdriver.exe) do (IF NOT %b=="" TASKKILL /F /PID %a)) [WinAppDriver] No old WinAppDrivers seemed to exist [WinAppDriver] Spawning winappdriver with: 4724/wd/hub [WinAppDriver] [STDOUT] Windows Application Driver listening for requests at: http://127.0.0.1:4724/wd/hub [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body [WinAppDriver] [STDOUT] Press ENTER to exit. [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] ========================================== [WinAppDriver] [STDOUT] GET /wd/hub/status HTTP/1.1 [WinAppDriver] [STDOUT] Accept: application/json, / [WinAppDriver] [STDOUT] Connection: close [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [WinAppDriver] [STDOUT] User-Agent: appium [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] HTTP/1.1 200 OK [WinAppDriver] [STDOUT] Content-Length: 147 [WinAppDriver] [STDOUT] Content-Type: application/json [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] {"build":{"revision":"18001","time":"Tue Sep 18 18:35:38 2018","version":"1.1.1809"},"os":{"arch":"amd64","name":"windows","version":"10.0.17134"}} [WD Proxy] Got response with status 200: "{\"build\":{\"revision\":\"18001\",\"time\":\"Tue Sep 18 18:35:38 2018\",\"version\":\"1.1.1809\"},\"os\":{\"arch\":\"amd64\",\"name\":\"windows\",\"version\":\"10.0.17134\"}}" [WinAppDriver] Status call returned 200. we're online and ready to run tests [WinAppDriver] WinAppDriver changed state to 'online' [WD Proxy] Matched '/session' to command name 'createSession' [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:4724/wd/hub/session] with body: {"desiredCapabilities":{"platformName":"Windows","app":"D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe","deviceName":"WindowsPC","newCommandTimeout":300}} [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] ========================================== [WinAppDriver] [STDOUT] POST /wd/hub/session HTTP/1.1 [WinAppDriver] [STDOUT] Accept: application/json, / [WinAppDriver] [STDOUT] Connection: close [WinAppDriver] [STDOUT] Content-Length: 183 [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [WinAppDriver] [STDOUT] User-Agent: appium [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] {"desiredCapabilities":{"platformName":"Windows","app":"D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe","deviceName":"WindowsPC","newCommandTimeout":300}} [WinAppDriver] [STDOUT] HTTP/1.1 500 Internal Error [WinAppDriver] [STDOUT] Content-Length: 212 [WinAppDriver] [STDOUT] Content-Type: application/json [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe, and processId: 21516"}} [WD Proxy] Got an unexpected response: {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe, and processId: 21516"}} [W3C] Matched W3C error code 'unknown error' to UnknownError [WinAppDriver] Deleting WinAppDriver session [BaseDriver] Event 'newSessionStarted' logged at 1554887654426 (14:14:14 GMT+0500 (Pakistan Standard Time)) [W3C] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Failed to locate opened application window with appId: D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe, and processId: 21516 [W3C] at errorFromW3CJsonCode (C:\Users\kmahmood\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:802:25) [W3C] at ProxyRequestError.errorFromW3CJsonCode [as getActualError] (C:\Users\kmahmood\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:685:14) [W3C] at JWProxy.getActualError [as command] (C:\Users\kmahmood\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:234:19) [HTTP] <-- POST /wd/hub/session 500 6548 ms - 1176 [HTTP] [HTTP] --> POST /wd/hub/session [HTTP] {"desiredCapabilities":{"platformName":"Windows","app":"D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe","deviceName":"WindowsPC","newCommandTimeout":300},"capabilities":{"firstMatch":[{"platformName":"Windows"}]}} [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"Windows","app":"D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe","deviceName":"WindowsPC","newCommandTimeout":300},null,{"firstMatch":[{"platformName":"Windows"}]}] [BaseDriver] Event 'newSessionRequested' logged at 1554887654509 (14:14:14 GMT+0500 (Pakistan Standard Time)) [Appium] Could not parse W3C capabilities: 'deviceName' can't be blank [Appium] Trying to fix W3C capabilities by merging them with JSONWP caps [BaseDriver] The capabilities ["app","deviceName","newCommandTimeout"] are not standard capabilities and should have an extension prefix [Appium] Appium v1.12.1 creating new WindowsDriver (v1.5.1) session [Appium] Capabilities: [Appium] app: D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe [Appium] deviceName: WindowsPC [Appium] newCommandTimeout: 300 [Appium] platformName: Windows [BaseDriver] Creating session with MJSONWP desired capabilities: {"platformName":"Windows","... [BaseDriver] The following capabilities were provided, but are not recognized by appium: app. [BaseDriver] Session created with session id: f6944381-be45-43e3-8053-d5d0a0b3f796 [WinAppDriver] You must use WinAppDriver version 1.1 [WinAppDriver] Verifying WinAppDriver version 1.1 is installed via comparing the checksum. [WinAppDriver] WinAppDriver changed state to 'starting' [WinAppDriver] Killing any old WinAppDrivers on same port, running: FOR /F "usebackq tokens=5" %a in (netstat -nao ^| findstr /R /C:"4724 ") do (FOR /F "usebackq" %b in (TASKLIST /FI "PID eq %a" ^| findstr /I winappdriver.exe) do (IF NOT %b=="" TASKKILL /F /PID %a)) [WinAppDriver] No old WinAppDrivers seemed to exist [WinAppDriver] Spawning winappdriver with: 4724/wd/hub [WinAppDriver] [STDOUT] Windows Application Driver listening for requests at: http://127.0.0.1:4724/wd/hub [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] ========================================== [WinAppDriver] [STDOUT] GET /wd/hub/status HTTP/1.1 [WinAppDriver] [STDOUT] Accept: application/json, / [WinAppDriver] [STDOUT] Connection: close [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [WinAppDriver] [STDOUT] User-Agent: appium [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] HTTP/1.1 200 OK [WinAppDriver] [STDOUT] Content-Length: 147 [WinAppDriver] [STDOUT] Content-Type: application/json [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] {"build":{"revision":"18001","time":"Tue Sep 18 18:35:38 2018","version":"1.1.1809"},"os":{"arch":"amd64","name":"windows","version":"10.0.17134"}} [WD Proxy] Got response with status 200: "{\"build\":{\"revision\":\"18001\",\"time\":\"Tue Sep 18 18:35:38 2018\",\"version\":\"1.1.1809\"},\"os\":{\"arch\":\"amd64\",\"name\":\"windows\",\"version\":\"10.0.17134\"}}" [WinAppDriver] Status call returned 200. we're online and ready to run tests [WinAppDriver] WinAppDriver changed state to 'online' [WD Proxy] Matched '/session' to command name 'createSession' [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:4724/wd/hub/session] with body: {"desiredCapabilities":{"platformName":"Windows","app":"D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe","deviceName":"WindowsPC","newCommandTimeout":300}} [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] ========================================== [WinAppDriver] [STDOUT] POST /wd/hub/session HTTP/1.1 [WinAppDriver] [STDOUT] Accept: application/json, / [WinAppDriver] [STDOUT] Connection: close [WinAppDriver] [STDOUT] Content-Length: 183 [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [WinAppDriver] [STDOUT] User-Agent: appium [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] {"desiredCapabilities":{"platformName":"Windows","app":"D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe","deviceName":"WindowsPC","newCommandTimeout":300}} [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] Address 'http://127.0.0.1:4724/wd/hub' is already in use [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] Failed to initialize: 0x80004005 [WinAppDriver] WinAppDriver exited unexpectedly with code 2147500037, signal null [WinAppDriver] WinAppDriver changed state to 'stopped' [WinAppDriver] [STDOUT] HTTP/1.1 500 Internal Error [WinAppDriver] [STDOUT] Content-Length: 212 [WinAppDriver] [STDOUT] Content-Type: application/json [WinAppDriver] [STDOUT] [WinAppDriver] [STDOUT] {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe, and processId: 22160"}} [WD Proxy] Got an unexpected response: {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe, and processId: 22160"}} [W3C] Matched W3C error code 'unknown error' to UnknownError [WinAppDriver] Deleting WinAppDriver session [BaseDriver] Event 'newSessionStarted' logged at 1554887660535 (14:14:20 GMT+0500 (Pakistan Standard Time)) [W3C] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Failed to locate opened application window with appId: D:\Development\Azzure\Dispatch\Dispatch.UI\bin\Debug\Dispatch.UI.exe, and processId: 22160 [W3C] at errorFromW3CJsonCode (C:\Users\kmahmood\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:802:25) [W3C] at ProxyRequestError.errorFromW3CJsonCode [as getActualError] (C:\Users\kmahmood\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:685:14) [W3C] at JWProxy.getActualError [as command] (C:\Users\kmahmood\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:234:19) [HTTP] <-- POST /wd/hub/session 500 6028 ms - 1176 [HTTP]

Code To Reproduce Issue [ Good To Have ]

Please remember that with sample code it's easier to reproduce the bug and it's much faster to fix it.

Please git clone https://github.com/appium/appium and from the sample-code directory, use one of your favourite languages and sample apps to reproduce the issue.

In case a similar scenario is missing in sample-code, please submit a PR with one of the sample apps provided.

mykola-mokhnach commented 5 years ago

Moved to the appropriate project

Kmran commented 5 years ago

Any update on this please ???