I am trying to automate an application on Windows11. We have .exe to run and need to create shortcut file on desktop to run. I have to click on that .lnk file to process further execution. So I am using winium driver to start .lnk application on port 9999. Now I have to continue automation on open application edge browser. i.e. When I click on .lnk file present on desktop, will open in Edge browser (IE Mode On). Then I will have to same session to login application.
Application is opening through winium driver but not able to login to application since driver session not working
ChromeTest.Java
import java.io.File;
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriverService;
import org.openqa.selenium.edge.EdgeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.winium.DesktopOptions;
import org.openqa.selenium.winium.WiniumDriver;
import org.openqa.selenium.winium.WiniumDriverService;
public class ChromeTest {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
WebDriver browser = null;
DesktopOptions option;
WiniumDriver windriver = null;
WiniumDriverService service = null;
String applicationPath = "C:\\Users\\My\\Desktop\\172.20.1.4.lnk";
// user profile path = C:\Users\My\AppData\Local\Microsoft\Edge\User Data\Default
try {
option = new DesktopOptions();
option.setApplicationPath(applicationPath);
option.setDebugConnectToRunningApp(false);
File driverPath = new File(System.getProperty("user.dir") + File.separator + "drivers" + File.separator
+ "Winium.Desktop.Driver.exe");
service = new WiniumDriverService.Builder().usingDriverExecutable(driverPath).usingPort(9999)
.withVerbose(true).withSilent(false).buildDesktopService();
try {
service.start();
} catch (IOException e) {
System.out.println("Exception while starting WINIUM service");
e.printStackTrace();
}
windriver = new WiniumDriver(service, option);
Thread.sleep(10000);
// creating instance of edge using port
System.out.println("1");
EdgeDriverService edgeservice = new EdgeDriverService.Builder()
.usingDriverExecutable(new File("D:\\My_Workspace\\ChromeTest\\drivers\\msedgedriver.exe")).usingPort(9999).build();
System.out.println("2");
edgeservice.start();
System.out.println("3");
System.out.println("URL :: "+edgeservice.getUrl());
browser = new RemoteWebDriver(edgeservice.getUrl(), new EdgeOptions());
System.out.println("4");
System.out.println("TITLE :: "+browser.getTitle());
Thread.sleep(20000);
} catch (Exception e) {
System.out.println(e);
}
Thread.sleep(20000);
Thread.sleep(20000);
// browser.quit();
// edgeDriverservice.stop();
service.stop();
// windriver.quit();
}
}
I am trying to automate an application on Windows11. We have .exe to run and need to create shortcut file on desktop to run. I have to click on that .lnk file to process further execution. So I am using winium driver to start .lnk application on port 9999. Now I have to continue automation on open application edge browser. i.e. When I click on .lnk file present on desktop, will open in Edge browser (IE Mode On). Then I will have to same session to login application.
Application is opening through winium driver but not able to login to application since driver session not working
ChromeTest.Java
POM.xml
Console Log :