appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.21k stars 755 forks source link

bug: appium.io is changing my capability names #1881

Open bistritapcv opened 1 year ago

bistritapcv commented 1 year ago

Is there an existing issue for this?

Current Behavior

I am running WinAppDriver with appium.io in Java/Eclipse on Windows.

The current behavior is that appium.io is prefixing my "app" and "appId" capabilities with "appium:" (i.e., "appium:app", "appium:appId") while WinAppDriver is expecting just "app" and "appId" and is therefore throwing an error that it is missing capability "appId" (since it is being passed "appium:appId"). I have tried several versions of appium.io in the pom.

Expected Behavior

either appium.io not prefix "appium" (or provide an option), or WinAppDriver recognize capabilities starting with "appium".

Minimal Reproducible Example

(while WinAppDriver is running):

    DesiredCapabilities dcaps = new DesiredCapabilities();
    dcaps.setCapability("automationName", "Windows");
    dcaps.setCapability("appId", "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\notepad.exe}");
    dcaps.setCapability("app", "C:\\Windows\\System32\\notepad.exe");
    dcaps.setCapability("appId", "C:\\Windows\\System32\\notepad.exe");
    dcaps.setCapability("platformName", "Windows");
    dcaps.setCapability("deviceName", "Windows PC");
    WindowsDriver app = new WindowsDriver(new URL("http://127.0.0.1:4723/"), dcaps);

Environment

Link to Appium Logs

see below

Futher Information

Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: Missing command parameter: appId Host info: host: 'XXXXXXXXXX' ,<-redacted Build info: version: '4.5.0', revision: 'fe167b119a' System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144' Driver info: io.appium.java_client.windows.WindowsDriver Command: [null, newSession {capabilities=[{appium:app=C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe, appium:automationName=Windows, appium:deviceName=Windows PC, platformName=WINDOWS}], desiredCapabilities=Capabilities {app: C:\Program Files (x86)\Wind..., automationName: Windows, deviceName: Windows PC, platformName: WINDOWS}}] Capabilities {} at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:144) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:126) at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:102) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:146) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:180) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:547) at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:224) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:157) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:79) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:87) at io.appium.java_client.windows.WindowsDriver.(WindowsDriver.java:48) at xxxxx.xxxxx.enterLoginInfo(xxxxx.java:69)

mykola-mokhnach commented 1 year ago

Such behaviour is expected. Java client 8 only support W3C, where vendor prefixes are required for all capabilities except of several standard ones. Either use it with appium-windows-driver, which does the necessary updates as WAD itself only support the legacy JWP protocol or consider using some older clients that still have the legacy JWP support

bistritapcv commented 1 year ago

Thanks you. Do you have some examples for older clients?

mykola-mokhnach commented 1 year ago

Unfortunately I don't. Microsoft though has several examples in their repository: https://github.com/microsoft/WinAppDriver/tree/master/Samples

bistritapcv commented 1 year ago

Winium worked perfectly but IT won't let us use it as there have been no updates in years. I suppose there won't be any more updates?

Sent from Yahoo Mail on Android

On Wed, Apr 12, 2023 at 6:05, Mykola @.***> wrote:

Unfortunately I don't. Microsoft though has several examples in their repository: https://github.com/microsoft/WinAppDriver/tree/master/Samples

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

bistritapcv commented 1 year ago

How important is developer mode? I set it on my machine to develop but I am not sure they will allow it on the production machines on which it will run.