I am trying to test window based app using my existing selenium project. I dont want to change anything in the existing code base just want to enable support for window based app so I have added below dependancies in the project but when I am triggering my test getting below error. Can someone help me please? Here is the code so far I have got::
WiniumDriver driver = null;
String appPath = "C:/windows/system32/calc.exe";
String address = "http://localhost:9999";
DesktopOptions option = new DesktopOptions();
option.setApplicationPath(appPath);
option.setDebugConnectToRunningApp(false);
option.setLaunchDelay(2);
driver = new WiniumDriver(new URL(address), option);
Dependency:
<dependency>
<groupId>com.github.2gis.winium</groupId>
<artifactId>winium-elements-desktop</artifactId>
<version>0.2.0-1</version>
</dependency>
<dependency>
<groupId>com.github.2gis.winium</groupId>
<artifactId>winium-webdriver</artifactId>
<version>0.1.0-1</version>
</dependency>
Error:
WARNING: Support for Legacy Capabilities is deprecated; You are sending the following invalid capabilities: [app, debugConnectToRunningApp, launchDelay]; Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Host info: host: 'UKC-3HTNSL3', ip: '192.168.0.26'
Build info: version: '4.9.0', revision: 'd7057100a6'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_281'
Driver info: org.openqa.selenium.winium.WiniumDriver
Command: [null, newSession {capabilities=[Capabilities {app: C:/windows/system32/calc.exe, debugConnectToRunningApp: false, launchDelay: 2}]}]
Capabilities {app: C:/windows/system32/calc.exe, debugConnectToRunningApp: false, launchDelay: 2}
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:561)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:229)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:157)
at org.openqa.selenium.winium.WiniumDriver.<init>(WiniumDriver.java:84)
at Acuitas.ui.myFirstTestCase.main(myFirstTestCase.java:30)
Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [app, debugConnectToRunningApp, launchDelay]
at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$4(NewSessionPayload.java:175)
at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:372)
at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:373)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:373)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:179)
at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:91)
at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:124)
at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:112)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:165)
at org.openqa.selenium.winium.WiniumDriverCommandExecutor.execute(WiniumDriverCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
... 4 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':TestClass.main()'.
> Process 'command 'C:/Program Files/Java/jdk1.8.0_281/bin/java.exe'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.