microsoft / WinAppDriver

Windows Application Driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

{"status":13,"value":{"error":"unknown error","message":"An unknown error occurred in the remote end while processing the command."}}

mooragor opened this issue · comments

Hi there. I'm completely new to Appium/WinAppDriver, trying it for the first time, so apologies if I'm doing something really silly.

I've tried starting WinAppDriver by running Appium, and also by itself, but seem to be getting this same error whenever I try to use it or call Status on a process.

Below is my best guess at a reproduction without appium being involved, I think I'm starting it the same way Appium is, with the same parameters.

I have absolutely no idea where to even start working out what's going wrong, so any suggestions gratefully received!

Appium v2.5.1
WindowsDriver's BaseDriver version is 9.5.2
Node v21.1.0

PS C:\Users\Me> & 'C:\Program Files\Windows Application Driver\WinAppDriver.exe' 4724/wd/hub
Windows Application Driver listening for requests at: http://127.0.0.1:4724/wd/hub
Press ENTER to exit.
==========================================
GET /wd/hub/status HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Connection: keep-alive
DNT: 1
Host: 127.0.0.1:4724
sec-ch-ua: "Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36


HTTP/1.1 500 Internal Error
Content-Length: 133
Content-Type: application/json

{"status":13,"value":{"error":"unknown error","message":"An unknown error occurred in the remote end while processing the command."}}

Starting Appium gets the same sort of responses

PS C:\Users\Me> appium
[Appium] Welcome to Appium v2.5.1
[Appium] The autodetected Appium home path: C:\Users\Me\.appium
[Appium] Attempting to load driver windows...
[Appium] Requiring driver at C:\Users\Me\.appium\node_modules\appium-windows-driver\build\index.js
[Appium] WindowsDriver has been successfully loaded in 0.097s
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] You can provide the following URLs in your client code to connect to this server:
[Appium]        http://192.168.1.153:4723/
[Appium]        http://192.168.56.1:4723/
[Appium]        http://127.0.0.1:4723/ (only accessible from the same host)
[Appium]        http://172.21.11.5:4723/
[Appium] Available drivers:
[Appium]   - windows@2.12.18 (automationName 'Windows')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
[HTTP] Request idempotency key: e0d0a7c5-89ef-491f-b840-6b7e68771c2c
[HTTP] --> POST /session
[HTTP] {"desiredCapabilities":{"platformame":"Windows","appium:app":"C:\\Windows\\System32\\notepad.exe","appium:automationName":"Windows","platformName":"Windows"},"capabilities":{"firstMatch":[{"appium:app":"C:\\Windows\\System32\\notepad.exe","appium:automationName":"Windows","platformName":"Windows"}]}}
[AppiumDriver@3cf7] Calling AppiumDriver.createSession() with args: [{"platformame":"Windows","appium:app":"C:\\Windows\\System32\\notepad.exe","appium:automationName":"Windows","platformName":"Windows"},null,{"firstMatch":[{"appium:app":"C:\\Windows\\System32\\notepad.exe","appium:automationName":"Windows","platformName":"Windows"}]}]
[AppiumDriver@3cf7] Event 'newSessionRequested' logged at 1710952293087 (16:31:33 GMT+0000 (Greenwich Mean Time))
[Appium] Attempting to find matching driver for automationName 'Windows' and platformName 'Windows'
[Appium] The 'windows' driver was installed and matched caps.
[Appium] Will require it at C:\Users\Me\.appium\node_modules\appium-windows-driver
[Appium] Requiring driver at C:\Users\Me\.appium\node_modules\appium-windows-driver\build\index.js
[AppiumDriver@3cf7] Appium v2.5.1 creating new WindowsDriver (v2.12.18) session
[AppiumDriver@3cf7] Checking BaseDriver versions for Appium and WindowsDriver
[AppiumDriver@3cf7] Appium's BaseDriver version is 9.5.2
[AppiumDriver@3cf7] WindowsDriver's BaseDriver version is 9.5.2
[WindowsDriver@8880] Creating session with W3C capabilities: {
[WindowsDriver@8880]   "alwaysMatch": {
[WindowsDriver@8880]     "platformName": "Windows",
[WindowsDriver@8880]     "appium:app": "C:\\Windows\\System32\\notepad.exe",
[WindowsDriver@8880]     "appium:automationName": "Windows"
[WindowsDriver@8880]   },
[WindowsDriver@8880]   "firstMatch": [
[WindowsDriver@8880]     {}
[WindowsDriver@8880]   ]
[WindowsDriver@8880] }
[WindowsDriver@8880 (ac6d7d62)] Session created with session id: ac6d7d62-3bc2-4f1f-9068-f60bbb28dc76
[WindowsDriver@8880 (ac6d7d62)] Spawning 'C:\Program Files\Windows Application Driver\WinAppDriver.exe' with args: ["4724/wd/hub"]
[WindowsDriver@8880 (ac6d7d62)] Matched '/status' to command name 'getStatus'
[WindowsDriver@8880 (ac6d7d62)] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body
[WindowsDriver@8880 (ac6d7d62)] connect ECONNREFUSED 127.0.0.1:4724
[WindowsDriver@8880 (ac6d7d62)] Windows Application Driver listening for requests at: http://127.0.0.1:4724/wd/hub
[WindowsDriver@8880 (ac6d7d62)] Press ENTER to exit.
[WindowsDriver@8880 (ac6d7d62)] Matched '/status' to command name 'getStatus'
[WindowsDriver@8880 (ac6d7d62)] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body
[WindowsDriver@8880 (ac6d7d62)] ==========================================
[WindowsDriver@8880 (ac6d7d62)] GET /wd/hub/status HTTP/1.1
[WindowsDriver@8880 (ac6d7d62)] Accept: application/json, */*
[WindowsDriver@8880 (ac6d7d62)] Accept-Encoding: gzip, compress, deflate, br
[WindowsDriver@8880 (ac6d7d62)] Connection: keep-alive
[WindowsDriver@8880 (ac6d7d62)] Content-Type: application/json; charset=utf-8
[WindowsDriver@8880 (ac6d7d62)] Host: 127.0.0.1:4724
[WindowsDriver@8880 (ac6d7d62)] User-Agent: appium
[WindowsDriver@8880 (ac6d7d62)] Got response with status 500: {"status":13,"value":{"error":"unknown error","message":"An unknown error occurred in the remote end while processing the command."}}
[W3C] Matched W3C error code 'unknown error' to UnknownError
[WindowsDriver@8880 (ac6d7d62)] HTTP/1.1 500 Internal Error
[WindowsDriver@8880 (ac6d7d62)] Content-Length: 133
[WindowsDriver@8880 (ac6d7d62)] Content-Type: application/json
[WindowsDriver@8880 (ac6d7d62)]
[WindowsDriver@8880 (ac6d7d62)] {"status":13,"value":{"error":"unknown error","message":"An unknown error occurred in the remote end while processing the command."}}
[WindowsDriver@8880 (ac6d7d62)] Matched '/status' to command name 'getStatus'
[WindowsDriver@8880 (ac6d7d62)] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body

Is the developer mode ON? What kind of application is this win32, WPF or UWP?
please go through the wiki?

Hi there - Developer mode is on. Ultimately I will be testing a WPF application, but I am getting these results when I try to start Notepad.exe

I have now had a go at cloning the WinAppDriver repo, and managed to successfully run the Notepad 'test' in there after standing up WinAppDriver.exe by itself, so I'm pretty sure there's not actually a problem with WinAppDriver by itself, maybe I need to move this question to an Appium forum as it may well be the Appium layer that I'm using incorrectly to pass the parameters through to WinAppDriver.

image

One thing I do notice as fairly different between the Appium example that I'm following and the Notepad Test code from the repo is that the Test code is using DesiredCapabilities(), where the Appium example is using AppiumOptions()

Both seem to be using OpenQA.Selenium.Appium.Windows, but I'm wondering if I've somehow got different versions of the package somehow.

There is an existing bug with appium where in it installs the winappdriver.exe at wrong location. Better to install winappdriver.exe first and then install appium.

As a bit of a final note on this. I eventually discovered that it was my application taking too long to start up, and WinAppDriver just thought it hadn't started properlt.

I added the following code to the DesiredCapabilities and it now can start my application

capabilities.SetCapability("ms:waitForAppLaunch", "10");

Please keep in mind that the maximum time out supported is 50 seconds.