Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinAppDriver not starting properly while using Appium Inspector #1982

Open
kenzoviski opened this issue Mar 12, 2024 · 17 comments
Open

WinAppDriver not starting properly while using Appium Inspector #1982

kenzoviski opened this issue Mar 12, 2024 · 17 comments

Comments

@kenzoviski
Copy link

kenzoviski commented Mar 12, 2024

Original issue at Appim repo: https://github.com/appium/appium/issues/19880
On Appium repo they told me its a problem with WinAppDriver and this is the reason I'm posting here.


After installing Node.js_20.11.1 LTS I managed to start Appium server successfully.
But still, I'm getting an error while executing the Appium Inspector when I click on "Start Sessions".

These are my "Capabilities":

{
  "appium:app": "D:\\Trabalho Freelancer\\FLOWApps\\Applications\\FLOW2BO\\flow2bo.exe",
  "platformName": "windows",
  "appium:automationName": "windows"
}

And I'm starting Appium server with the following command: appium --address 127.0.0.1 --port 4723

And on Appium server I get the following error:

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 D:\Trabalho Freelancer\FlowAutomation\node_modules\appium-windows-driver
[Appium] Requiring driver at D:\Trabalho Freelancer\FlowAutomation\node_modules\appium-windows-driver\build\index.js
[AppiumDriver@ce67] Appium v2.5.1 creating new WindowsDriver (v2.12.18) session
[AppiumDriver@ce67] Checking BaseDriver versions for Appium and WindowsDriver
[AppiumDriver@ce67] Appium's BaseDriver version is 9.5.2
[AppiumDriver@ce67] WindowsDriver's BaseDriver version is 9.5.2
[WindowsDriver@1b02] Creating session with W3C capabilities: {
[WindowsDriver@1b02]   "alwaysMatch": {
[WindowsDriver@1b02]     "platformName": "windows",
[WindowsDriver@1b02]     "appium:app": "D:\\Trabalho Freelancer\\FLOWApps\\Applications\\FLOW2BO\\flow2bo.exe",
[WindowsDriver@1b02]     "appium:automationName": "windows",
[WindowsDriver@1b02]     "appium:newCommandTimeout": 3600,
[WindowsDriver@1b02]     "appium:connectHardwareKeyboard": true
[WindowsDriver@1b02]   },
[WindowsDriver@1b02]   "firstMatch": [
[WindowsDriver@1b02]     {}
[WindowsDriver@1b02]   ]
[WindowsDriver@1b02] }
[WindowsDriver@1b02] The following provided capabilities were not recognized by this driver:
[WindowsDriver@1b02]   connectHardwareKeyboard
[WindowsDriver@1b02 (b60ea8e7)] Session created with session id: b60ea8e7-b05f-43be-8842-6051c26c16bf
[WindowsDriver@1b02 (b60ea8e7)] Spawning 'C:\Program Files\Windows Application Driver\WinAppDriver.exe' with args: ["4724/wd/hub"]
[WindowsDriver@1b02 (b60ea8e7)] Matched '/status' to command name 'getStatus'
[WindowsDriver@1b02 (b60ea8e7)] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body
[WindowsDriver@1b02 (b60ea8e7)] connect ECONNREFUSED 127.0.0.1:4724
[WindowsDriver@1b02 (b60ea8e7)] Windows Application Driver listening for requests at: http://127.0.0.1:4724/wd/hub
[WindowsDriver@1b02 (b60ea8e7)] Press ENTER to exit.
[WindowsDriver@1b02 (b60ea8e7)] Matched '/status' to command name 'getStatus'
[WindowsDriver@1b02 (b60ea8e7)] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body
[WindowsDriver@1b02 (b60ea8e7)] ==========================================
[WindowsDriver@1b02 (b60ea8e7)] GET /wd/hub/status HTTP/1.1
[WindowsDriver@1b02 (b60ea8e7)] Accept: application/json, */*
[WindowsDriver@1b02 (b60ea8e7)] Accept-Encoding: gzip, compress, deflate, br
[WindowsDriver@1b02 (b60ea8e7)] Connection: keep-alive
[WindowsDriver@1b02 (b60ea8e7)] Content-Type: application/json; charset=utf-8
[WindowsDriver@1b02 (b60ea8e7)] Host: 127.0.0.1:4724
[WindowsDriver@1b02 (b60ea8e7)] User-Agent: appium
[WindowsDriver@1b02 (b60ea8e7)] 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

Appium inspector gives the error:
Failed to create session. An unknown server-side error occurred while processing the command. Original error: WinAppDriver server is not listening within 10000ms timeout. Make sure it could be started manually

OpenQA.Selenium.WebDriverException : An unknown server-side error occurred while processing the command. Original error: WinAppDriver server is not listening within 10000ms timeout. Make sure it could be started manually
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Appium.AppiumDriver`1.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Appium.AppiumDriver`1..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
   at OpenQA.Selenium.Appium.AppiumDriver`1..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
   at OpenQA.Selenium.Appium.AppiumDriver`1..ctor(Uri remoteAddress, ICapabilities appiumOptions)
   at OpenQA.Selenium.Appium.Windows.WindowsDriver`1..ctor(Uri remoteAddress, AppiumOptions AppiumOptions)
   at FlowAutomation.Tests.Test1() in D:\Trabalho Freelancer\FlowAutomation\test\specs\test1.cs:line 27
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

How do I fix this, so I can hook my app to Appium Inspector and start identifying the elements on my desktop app (flow2bo)?

@kenzoviski
Copy link
Author

Installed previous version of WAD and managed to make it work with Appium.
Unfortunately Appium Inspector isn't able to identify all the elements on my desktop app.

Guess there's not an open-source good tool to automate tests in Windows.

@anunay1
Copy link

anunay1 commented Mar 12, 2024

Always use inspect.exe instead of appium inspector.

@kenzoviski
Copy link
Author

Always use inspect.exe instead of appium inspector.

You mean the one on this repo: https://github.com/blackrosezy/gui-inspect-tool
?

@Shakevg
Copy link

Shakevg commented Mar 12, 2024

Always use inspect.exe instead of appium inspector.

You mean the one on this repo: https://github.com/blackrosezy/gui-inspect-tool ?

https://github.com/microsoft/WinAppDriver/blob/master/Docs/FAQ.md#what-is-inspectexe

@anunay1
Copy link

anunay1 commented Mar 12, 2024

No the one that comes with windows SDK.

@kenzoviski
Copy link
Author

Always use inspect.exe instead of appium inspector.

You mean the one on this repo: https://github.com/blackrosezy/gui-inspect-tool ?

https://github.com/microsoft/WinAppDriver/blob/master/Docs/FAQ.md#what-is-inspectexe

I'm confused, in order to automate tests in desktop apps using Winappdriver, do I need appium?

What references do I use (openQA.Selenium.Appium)?
I'm starting a test project in the C# on Vs code but I don't wanna use appium, only want nUnit, selenium and winappdriver. Is it possible?

@anunay1
Copy link

anunay1 commented Mar 13, 2024

Yes.

@kenzoviski
Copy link
Author

Yes.

OK, so what version of .NET should I use in my project and what are the references/classes for selenium and Windows driver element that I should also use?

@anunay1
Copy link

anunay1 commented Mar 13, 2024

Please check the wiki page.

@anunay1
Copy link

anunay1 commented Mar 13, 2024

https://github.com/microsoft/WinAppDriver/tree/master/Docs

@kenzoviski
Copy link
Author

kenzoviski commented Mar 13, 2024

https://github.com/microsoft/WinAppDriver/tree/master/Docs

Thank you so much for the help.
I'm trying to understand how to create Xpaths using "Inspect" from MS. I thought the "Inspect" would give me the attributes of elements and also able to create the Xpath but I'm coming to realize it doesn't have such ability which is a bummer.

Do you advise any "spy tool" that is able to create the xpath or is "Inspect" able to do it and I'm not seeing it?

@anunay1
Copy link

anunay1 commented Mar 13, 2024

Xpath are very slow in identifying the elements and it's a known issue. I have only used name, classname and automation ID.

@kenzoviski
Copy link
Author

Xpath are very slow in identifying the elements and it's a known issue. I have only used name, classname and automation ID.

Ok, thanks for the tip. I managed to grab on Inspect the AutimationId or the name of my element.

@kenzoviski
Copy link
Author

Xpath are very slow in identifying the elements and it's a known issue. I have only used name, classname and automation ID.

The problem is that the desktop app I'm trying to identify elements with Inspect.exe doesn't have any properties for the elements LOLOL
inspect_x86_U1b6pid7mE

And all the buttons on the left tree are also "ClassName" = "Button" lololol, without Name, AcessibilityID and AutomationID how in the hell am I suppose to identity this? Inspect doesn't give me Xpath either :x

@anunay1
Copy link

anunay1 commented Mar 13, 2024

If the application is under your control ask the developer to implement properties.

@kenzoviski
Copy link
Author

If the application is under your control ask the developer to implement properties.

LOL yes it is under our control but the devs don't care if the elements have properties. It's fine I understand your point of view, because we, testers, need to be able to grab something in order to automate. But unfortunatly devs don't care about testers, at least where I work.

@Shakevg
Copy link

Shakevg commented Mar 14, 2024

Also, one more point is that real available controls can be different with inspector.exe.
You can use Inspector.exe for better visual displaying controls tree, but better save window structure using Session.PageSource, save to XML and create localor base on it (you can use next site to quickly validate your Xpath: xpather.com)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants