microsoft / WinAppDriver

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

WinApp Driver not supporting Appium and Selenium upgrade in Java #1949

Open RamaNarasimhaChanda opened 9 months ago

RamaNarasimhaChanda commented 9 months ago

Windows application driver not able to support latest version's of Appium and Selenium upgrades in Java. Driver throws app bad capabilities error , But same code works fine with down graded versions.

Don't work with

io.appium java-client 8.3.0 org.seleniumhq.selenium selenium-java 4.11.0

Work with

io.appium java-client 7.0.0 org.seleniumhq.selenium selenium-java 3.141.59
RamaNarasimhaChanda commented 9 months ago

@DHowett Can you help here , is there any plan from micro soft.

igorrecioh commented 9 months ago

@RamaNarasimhaChanda , I'm sorry but we have no news from @DHowett or any other team member from Microsoft about the future of this project. You can check this issue for more info

RamaNarasimhaChanda commented 9 months ago

@igorrecioh thank you for updating here , Looks like Windows application driver project is closed.

Auto81 commented 9 months ago

I have win app driver working with appium java client 9.0.0 and selenium java 4.14.1.

What error are you getting?

RamaNarasimhaChanda commented 9 months ago

@Auto81 Facing this issue with Java Client 9.0.0 and Selenium 4.14.1. Same configuration identifies my application with appium 7.0.0 and selenium 3.14.1.

with POST /session HTTP/1.1 Content-Length: 251 Content-Type: application/json; charset=utf-8 Host: 127.0.0.1:4723 User-Agent: appium/9.0.0 (selenium/4.14.1 (java windows))

{ "capabilities": { "firstMatch": [ { } ], "alwaysMatch": { "appium:app": "XXXXXXX", "appium:automationName": "Windows", "platformName": "windows" } } } HTTP/1.1 400 Bad Request Content-Length: 141 Content-Type: application/json

{"status":100,"value":{"error":"invalid argument","message":"Bad capabilities. Specify either app or appTopLevelWindow to create a session"}}

Auto81 commented 9 months ago

I'm running through an appium 2 server, with the appium windows driver installed. Is your appium server the same?

laellsr commented 8 months ago

I'm running through an appium 2 server, with the appium windows driver installed. Is your appium server the same?

Hello, Auto81! Can you show me how you start a new windows session with this?

Auto81 commented 8 months ago

I'm running through an appium 2 server, with the appium windows driver installed. Is your appium server the same?

Hello, Auto81! Can you show me how you start a new windows session with this?

Hey,

  1. Install WinAppDriver - https://github.com/microsoft/WinAppDriver/releases/tag/v1.2.1
  2. Install Node.js - https://nodejs.org/en/download/current
  3. Install Appium 2 via command prompt npm i -g appium
  4. Install appium windows driver via command prompt appium driver install --source=npm appium-windows-driver
  5. Install Appium Inspector - https://github.com/appium/appium-inspector/releases/tag/v2023.11.1
  6. In command prompt run appium
  7. In Appium Inspector set the Desired Capabilities with the following JSON
    {
    "app": "Root",
    "platformName": "WINDOWS",
    "automationName": "WINDOWS"
    }
  8. Click Start Session

That should be you set up and running an appium session hooked into a root/desktop windows session.

The appium inspector can give you alot of session details and code snippets that you can use as examples :)

If you can confirm that works I can give pointers on connecting via java bindings

laellsr commented 8 months ago

{ "deviceName": "WINDOWS", "app": "Root", "driverType": "WINDOWS", "platformName": "WINDOWS", "automationName": "WINDOWS" }

Thank you for response!

I received these logs

Appium server:

C:\Windows\system32>appium
[Appium] Welcome to Appium v2.2.2
[Appium] Attempting to load driver uiautomator2...
[Appium] Requiring driver at C:\Users\Edge\.appium\node_modules\appium-uiautomator2-driver
[Appium] Attempting to load driver windows...
[Appium] Requiring driver at C:\Users\Edge\.appium\node_modules\appium-windows-driver
[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.0.6:4723/
[Appium]        http://192.168.254.1:4723/
[Appium]        http://192.168.199.1:4723/
[Appium]        http://127.0.0.1:4723/ (only accessible from the same host)
[Appium] Available drivers:
[Appium]   - uiautomator2@2.14.0 (automationName 'UiAutomator2')
[Appium]   - windows@2.12.12 (automationName 'Windows')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.

Appium inspector:

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

image

laellsr commented 8 months ago

With capability ms:experimental-webdriver

Log loop

[HTTP] --> POST /session
[HTTP] {"capabilities":{"alwaysMatch":{"appium:deviceName":"WINDOWS","appium:app":"Root","appium:driverType":"WINDOWS","platformName":"WINDOWS","appium:automationName":"WINDOWS","ms:experimental-webdriver":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true},"firstMatch":[{}]},"desiredCapabilities":{"appium:deviceName":"WINDOWS","appium:app":"Root","appium:driverType":"WINDOWS","platformName":"WINDOWS","appium:automationName":"WINDOWS","ms:experimental-webdriver":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true}}
[AppiumDriver@ea13] Calling AppiumDriver.createSession() with args: [{"appium:deviceName":"WINDOWS","appium:app":"Root","appium:driverType":"WINDOWS","platformName":"WINDOWS","appium:automationName":"WINDOWS","ms:experimental-webdriver":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true},null,{"alwaysMatch":{"appium:deviceName":"WINDOWS","appium:app":"Root","appium:driverType":"WINDOWS","platformName":"WINDOWS","appium:automationName":"WINDOWS","ms:experimental-webdriver":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true},"firstMatch":[{}]}]
[AppiumDriver@ea13] Event 'newSessionRequested' logged at 1700080646296 (17:37:26 GMT-0300 (Horário Padrão de Brasília))
[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\Edge\.appium\node_modules\appium-windows-driver
[Appium] Requiring driver at C:\Users\Edge\.appium\node_modules\appium-windows-driver
[AppiumDriver@ea13] Appium v2.2.2 creating new WindowsDriver (v2.12.12) session
[AppiumDriver@ea13] Checking BaseDriver versions for Appium and WindowsDriver
[AppiumDriver@ea13] Appium's BaseDriver version is 9.4.2
[AppiumDriver@ea13] WindowsDriver's BaseDriver version is 9.4.2
[WindowsDriver@a9ef] Creating session with W3C capabilities: {
[WindowsDriver@a9ef]   "alwaysMatch": {
[WindowsDriver@a9ef]     "platformName": "WINDOWS",
[WindowsDriver@a9ef]     "ms:experimental-webdriver": true,
[WindowsDriver@a9ef]     "appium:deviceName": "WINDOWS",
[WindowsDriver@a9ef]     "appium:app": "Root",
[WindowsDriver@a9ef]     "appium:driverType": "WINDOWS",
[WindowsDriver@a9ef]     "appium:automationName": "WINDOWS",
[WindowsDriver@a9ef]     "appium:newCommandTimeout": 3600,
[WindowsDriver@a9ef]     "appium:connectHardwareKeyboard": true
[WindowsDriver@a9ef]   },
[WindowsDriver@a9ef]   "firstMatch": [
[WindowsDriver@a9ef]     {}
[WindowsDriver@a9ef]   ]
[WindowsDriver@a9ef] }
[WindowsDriver@a9ef] The following provided capabilities were not recognized by this driver:
[WindowsDriver@a9ef]   deviceName
[WindowsDriver@a9ef]   driverType
[WindowsDriver@a9ef]   connectHardwareKeyboard
[WindowsDriver@a9ef (144de09f)] Session created with session id: 144de09f-1c3d-48f2-a241-7e50a0d2eefa
[WindowsDriver@a9ef (144de09f)] Spawning 'C:\Program Files\Windows Application Driver\WinAppDriver.exe' with args: ["4724/wd/hub"]
[WindowsDriver@a9ef (144de09f)] Matched '/status' to command name 'getStatus'
[WindowsDriver@a9ef (144de09f)] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body
[WindowsDriver@a9ef (144de09f)] Windows Application Driver listening for requests at: http://127.0.0.1:4724/wd/hub
[WindowsDriver@a9ef (144de09f)] Press ENTER to exit.
[WindowsDriver@a9ef (144de09f)] ==========================================
[WindowsDriver@a9ef (144de09f)] GET /wd/hub/status HTTP/1.1
[WindowsDriver@a9ef (144de09f)] Accept: application/json, */*
[WindowsDriver@a9ef (144de09f)] Accept-Encoding: gzip, compress, deflate, br
[WindowsDriver@a9ef (144de09f)] Connection: keep-alive
[WindowsDriver@a9ef (144de09f)] Content-Type: application/json; charset=utf-8
[WindowsDriver@a9ef (144de09f)] Host: 127.0.0.1:4724
[WindowsDriver@a9ef (144de09f)] User-Agent: appium
[WindowsDriver@a9ef (144de09f)] 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@a9ef (144de09f)] HTTP/1.1 500 Internal Error
[WindowsDriver@a9ef (144de09f)] Content-Length: 133
[WindowsDriver@a9ef (144de09f)] Content-Type: application/json
[WindowsDriver@a9ef (144de09f)] Matched '/status' to command name 'getStatus'
[WindowsDriver@a9ef (144de09f)] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body
[WindowsDriver@a9ef (144de09f)] ==========================================
[WindowsDriver@a9ef (144de09f)] GET /wd/hub/status HTTP/1.1
[WindowsDriver@a9ef (144de09f)] Accept: application/json, */*
[WindowsDriver@a9ef (144de09f)] Accept-Encoding: gzip, compress, deflate, br
[WindowsDriver@a9ef (144de09f)] Connection: keep-alive
[WindowsDriver@a9ef (144de09f)] Content-Type: application/json; charset=utf-8
[WindowsDriver@a9ef (144de09f)] Host: 127.0.0.1:4724
[WindowsDriver@a9ef (144de09f)] User-Agent: appium
[WindowsDriver@a9ef (144de09f)] 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@a9ef (144de09f)] HTTP/1.1 500 Internal Error
[WindowsDriver@a9ef (144de09f)] Content-Length: 133
[WindowsDriver@a9ef (144de09f)] Content-Type: application/json
[WindowsDriver@a9ef (144de09f)]
[WindowsDriver@a9ef (144de09f)] {"status":13,"value":{"error":"unknown error","message":"An unknown error occurred in the remote end while processing the command."}}
[WindowsDriver@a9ef (144de09f)] Matched '/status' to command name 'getStatus'
[WindowsDriver@a9ef (144de09f)] Proxying [GET /status] to [GET http://127.0.0.1:4724/wd/hub/status] with no body
[WindowsDriver@a9ef (144de09f)] ==========================================
Auto81 commented 8 months ago

Could you try closing all your command prompt windows and open a new one then run winappdriver to check its installed and runnable manually. You should see an output line off

Windows Application Driver listening for requests at: http://127.0.0.1:4723
Press ENTER to exit.

Press Enter to close the winappdriver, then run appium and try to connect from inspector again

laellsr commented 8 months ago

Yes, all setup is working.

For months I have been using Appium in version 7 and Selenium in version 3 for Windows automation.

For a moment I had false hope.

Can you make a simples video using the updated version?

Auto81 commented 8 months ago

Yes, all setup is working.

For months I have been using Appium in version 7 and Selenium in version 3 for Windows automation.

For a moment I had false hope.

So that set up is working through Appium Inspector for you now on machine? None of this is touching Java yet, and my java set up is pointed at the appium server we are running in command prompt window. So if your Inspector can't get a session I don't think java will be able to either

laellsr commented 8 months ago

I have win app driver working with appium java client 9.0.0 and selenium java 4.14.1.

What error are you getting?

But how do you do it? Can you take a screenshot?

Auto81 commented 8 months ago

I have win app driver working with appium java client 9.0.0 and selenium java 4.14.1. What error are you getting?

But how do you do it? Can you take a screenshot?

The above setup needs to be inplace for the way i have it set up as java calls out to the appium server, the java driver init is just pointing at appium server via var driver = new WindowsDriver(new URL("localhost:4723"), options);

HowTurnRight commented 8 months ago

I have win app driver working with appium java client 9.0.0 and selenium java 4.14.1. What error are you getting?

But how do you do it? Can you take a screenshot?

It works but a lot of "not impleemned" error will occur anyway.

RamaNarasimhaChanda commented 3 months ago

@laellsr @Auto81 Do we have any confirmation from the Appium team about their plans to continue supporting Windows application driver in its future releases? I raised a topic https://discuss.appium.io/t/appium-2-windows-application-driver-support/42056 haven't received any response.

a-einstein commented 1 month ago

This seems the same issue at Appium Windows Driver. Unable to start WAD during use

Some more remarks there. Various WinAppDriver calls don't work as expected or throw weird errors