microsoft / WinAppDriver

Windows Application Driver
MIT License
3.7k stars 1.4k forks source link

Failed to locate opened application window with appId: C:\\Users\\XXX\\AppData\\Local\\Microsoft\\Teams\\current\\Teams.exe, and processId: 34740 #1355

Open hhdd92 opened 4 years ago

hhdd92 commented 4 years ago

Hi,

I am using Appium to test Microsoft Teams on my local machine, however I got the below error, could you help to take a look? Thanks. The program could start the Teams app, but then counter the below errors. Any suggestion will be welcome.

OS: windows 10 Appium: 1.18.3 windows app driver: 1.2.1910.2002 Node: 12.18.2

[info] [Appium] Welcome to Appium v1.18.3 [info] [Appium] Non-default server args: [info] [Appium] relaxedSecurityEnabled: true [info] [Appium] allowInsecure: { [info] [Appium] } [info] [Appium] denyInsecure: { [info] [Appium] } [info] [Appium] Appium REST http interface listener started on 0.0.0.0:4723[debug] [HTTP] Request idempotency key: 3cdde18a-26a9-43f8-a299-af00e7dda35d [info] [HTTP] --> POST /wd/hub/session [info] [HTTP] {"capabilities":{"firstMatch":[{"platformName":"Windows","appium:deviceName":"WindowsPC","appium:noReset":true,"appium:app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}]},"desiredCapabilities":{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}} [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"},null,{"firstMatch":[{"platformName":"Windows","appium:deviceName":"WindowsPC","appium:noReset":true,"appium:app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}]}] [debug] [BaseDriver] Event 'newSessionRequested' logged at 1603773482957 (21:38:02 GMT-0700 (Pacific Daylight Time)) [info] [Appium] Appium v1.18.3 creating new WindowsDriver (v1.13.0) session [info] [Appium] Applying relaxed security to 'WindowsDriver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure [debug] [BaseDriver] Creating session with MJSONWP desired capabilities: { [debug] [BaseDriver] "platformName": "Windows", [debug] [BaseDriver] "deviceName": "WindowsPC", [debug] [BaseDriver] "noReset": true, [debug] [BaseDriver] "app": "C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe" [debug] [BaseDriver] } [info] [BaseDriver] Session created with session id: 105f0d87-84f8-4dbb-83bc-732c0920ea4e[info] [WinAppDriver] No old WinAppDrivers seemed to exist [info] [WinAppDriver] Spawning WinAppDriver with: 4724/wd/hub [info] [WinAppDriver] [STDOUT] Windows Application Driver listening for requests at: http://127.0.0.1:4724/wd/hub [debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body [info] [WinAppDriver] [STDOUT] Press ENTER to exit. [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] ========================================== [info] [WinAppDriver] [STDOUT] GET /wd/hub/status HTTP/1.1 [info] [WinAppDriver] [STDOUT] Accept: application/json, / [info] [WinAppDriver] [STDOUT] Connection: keep-alive [info] [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [info] [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [info] [WinAppDriver] [STDOUT] User-Agent: appium [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] [debug] [WD Proxy] Got response with status 200: {"build":{"revision":"2002","time":"Wed Oct 2 21:08:40 2019","version":"1.2.1910"},"os":{"arch":"amd64","name":"windows","version":"10.0.19042"}} [info] [WinAppDriver] Status call returned 200. we're online and ready to run tests [debug] [WinAppDriver] WinAppDriver changed state to 'online' [debug] [WinAppDriver] Starting WinAppDriver session. Will timeout in '20000' ms. [debug] [WD Proxy] Matched '/session' to command name 'createSession' [debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:4724/wd/hub/session] with body: {"desiredCapabilities":{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}} [info] [WinAppDriver] [STDOUT] HTTP/1.1 200 OK [info] [WinAppDriver] [STDOUT] Content-Length: 146 [info] [WinAppDriver] [STDOUT] Content-Type: application/json [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] {"build":{"revision":"2002","time":"Wed Oct 2 21:08:40 2019","version":"1.2.1910"},"os":{"arch":"amd64","name":"windows","version":"10.0.19042"}} [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] ========================================== [info] [WinAppDriver] [STDOUT] POST /wd/hub/session HTTP/1.1 [info] [WinAppDriver] [STDOUT] Accept: application/json, / [info] [WinAppDriver] [STDOUT] Connection: keep-alive [info] [WinAppDriver] [STDOUT] Content-Length: 171 [info] [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [info] [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [info] [WinAppDriver] [STDOUT] User-Agent: appium [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] {"desiredCapabilities":{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}}[info] [WinAppDriver] [STDOUT] HTTP/1.1 500 Internal Error [info] [WinAppDriver] [STDOUT] Content-Length: 209 [info] [WinAppDriver] [STDOUT] Content-Type: application/json [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740"}} [info] [WD Proxy] Got response with status 500: {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740"}} [debug] [W3C] Matched W3C error code 'unknown error' to UnknownError [warn] [WinAppDriver] Could not start WinAppDriver session error = 'An unknown server-side error occurred while processing the command. Original error: Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740', attempt = '1' from 'undefined'[debug] [WD Proxy] Matched '/session' to command name 'createSession' [debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:4724/wd/hub/session] with body: {"desiredCapabilities":{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}} [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] ========================================== [info] [WinAppDriver] [STDOUT] POST /wd/hub/session HTTP/1.1 [info] [WinAppDriver] [STDOUT] Accept: application/json, / [info] [WinAppDriver] [STDOUT] Connection: keep-alive [info] [WinAppDriver] [STDOUT] Content-Length: 171 [info] [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [info] [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [info] [WinAppDriver] [STDOUT] User-Agent: appium [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] HTTP/1.1 500 Internal Error [info] [WinAppDriver] [STDOUT] Content-Length: 209 [info] [WinAppDriver] [STDOUT] Content-Type: application/json [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740"}} [info] [WD Proxy] Got response with status 500: {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740"}} [debug] [W3C] Matched W3C error code 'unknown error' to UnknownError [warn] [WinAppDriver] Could not start WinAppDriver session error = 'An unknown server-side error occurred while processing the command. Original error: Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740', attempt = '2' from 'undefined'[debug] [WD Proxy] Matched '/session' to command name 'createSession' [debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:4724/wd/hub/session] with body: {"desiredCapabilities":{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}} [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] ========================================== [info] [WinAppDriver] [STDOUT] POST /wd/hub/session HTTP/1.1 [info] [WinAppDriver] [STDOUT] Accept: application/json, / [info] [WinAppDriver] [STDOUT] Connection: keep-alive [info] [WinAppDriver] [STDOUT] Content-Length: 171 [info] [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [info] [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [info] [WinAppDriver] [STDOUT] User-Agent: appium [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] HTTP/1.1 500 Internal Error [info] [WinAppDriver] [STDOUT] Content-Length: 209 [info] [WinAppDriver] [STDOUT] Content-Type: application/json [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740"}} [info] [WD Proxy] Got response with status 500: {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740"}} [debug] [W3C] Matched W3C error code 'unknown error' to UnknownError [warn] [WinAppDriver] Could not start WinAppDriver session error = 'An unknown server-side error occurred while processing the command. Original error: Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740', attempt = '3' from 'undefined'[debug] [WD Proxy] Matched '/session' to command name 'createSession' [debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:4724/wd/hub/session] with body: {"desiredCapabilities":{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}} [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] ========================================== [info] [WinAppDriver] [STDOUT] POST /wd/hub/session HTTP/1.1 [info] [WinAppDriver] [STDOUT] Accept: application/json, / [info] [WinAppDriver] [STDOUT] Connection: keep-alive [info] [WinAppDriver] [STDOUT] Content-Length: 171 [info] [WinAppDriver] [STDOUT] Content-Type: application/json; charset=utf-8 [info] [WinAppDriver] [STDOUT] Host: 127.0.0.1:4724 [info] [WinAppDriver] [STDOUT] User-Agent: appium [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] {"desiredCapabilities":{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}}[info] [WinAppDriver] [STDOUT] HTTP/1.1 500 Internal Error [info] [WinAppDriver] [STDOUT] Content-Length: 209 [info] [WinAppDriver] [STDOUT] Content-Type: application/json [info] [WinAppDriver] [STDOUT] [info] [WinAppDriver] [STDOUT] {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740"}} [info] [WD Proxy] Got response with status 500: {"status":13,"value":{"error":"unknown error","message":"Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740"}} [debug] [W3C] Matched W3C error code 'unknown error' to UnknownError [warn] [WinAppDriver] Could not start WinAppDriver session error = 'An unknown server-side error occurred while processing the command. Original error: Failed to locate opened application window with appId: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740', attempt = '4' from 'undefined' [debug] [WinAppDriver] timeoutError was Condition unmet after 23766 ms. Timing out. [debug] [WinAppDriver] Deleting WinAppDriver session [debug] [BaseDriver] Event 'newSessionStarted' logged at 1603773507405 (21:38:27 GMT-0700 (Pacific Daylight Time)) [debug] [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: C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe, and processId: 34740 [debug] [W3C] at errorFromW3CJsonCode (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:780:25) [debug] [W3C] at ProxyRequestError.getActualError (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:663:14) [debug] [W3C] at JWProxy.command (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:278:19) [debug] [W3C] at processTicksAndRejections (internal/process/task_queues.js:85:5) [debug] [W3C] Destroying socket connection [info] [HTTP] <-- POST /wd/hub/session 500 24482 ms - 1113 [info] [HTTP] [debug] [HTTP] Request idempotency key: de50b983-b6cf-48da-b5b6-7e2fa6eb7adc [info] [HTTP] --> POST /wd/hub/session [info] [HTTP] {"capabilities":{"firstMatch":[{"platformName":"Windows","appium:deviceName":"WindowsPC","appium:noReset":true,"appium:app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}]},"desiredCapabilities":{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}} [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"Windows","deviceName":"WindowsPC","noReset":true,"app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"},null,{"firstMatch":[{"platformName":"Windows","appium:deviceName":"WindowsPC","appium:noReset":true,"appium:app":"C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe"}]}] [debug] [BaseDriver] Event 'newSessionRequested' logged at 1603773508475 (21:38:28 GMT-0700 (Pacific Daylight Time)) [info] [Appium] Appium v1.18.3 creating new WindowsDriver (v1.13.0) session [info] [Appium] Applying relaxed security to 'WindowsDriver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure [debug] [BaseDriver] Creating session with MJSONWP desired capabilities: { [debug] [BaseDriver] "platformName": "Windows", [debug] [BaseDriver] "deviceName": "WindowsPC", [debug] [BaseDriver] "noReset": true, [debug] [BaseDriver] "app": "C:\Users\xxx\AppData\Local\Microsoft\Teams\current\Teams.exe" [debug] [BaseDriver] } [info] [BaseDriver] Session created with session id: f79c9b5c-8fcc-4e54-86b9-c010a03e8a92 [debug] [WinAppDriver] WinAppDriver changed state to 'starting' [info] [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))[info] [WinAppDriver] No old WinAppDrivers seemed to exist [info] [WinAppDriver] Spawning WinAppDriver with: 4724/wd/hub [info] [WinAppDriver] [STDOUT] Windows Application Driver listening for requests at: http://127.0.0.1:4724/wd/hub [debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body

Wolfe1 commented 4 years ago

Since Teams has a splash screen when starting you probably have to attach to the new window that it creates. Some details linked in this other issue: https://github.com/microsoft/WinAppDriver/issues/1341

hhdd92 commented 4 years ago

Thank you @Wolfe1 , I will have a try.

varun210619 commented 4 years ago

You can try to use desktopsession