How to perform automation in edge browser open using desktop application?

Viewed 46

I have a Web application to automate using selenium and Java.

Application supports IE Browser on windows10 and for windows11 we have created an .lnk file to open same application in Edge browser because IE is no longer. And we have some videos to be streamed in application for which media player to be installed and more.

Scenario :

  1. I have to open ABC.lnk application from desktop
  2. Once clicked on ABC.lnk application, our application will open in Edge browser.

for step 1 : using below code to open ABC.lnk application

public static void openWindowApplication() {
        String command = "C:\\Users\\Kasper\\Desktop\\ABC.lnk";
        try {
            Runtime.getRuntime().exec("cmd /c " + command);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

Step 2 :

Edge driver initialization Code :

System.setProperty("webdriver.edge.driver", FileReaderManager.getInstance().getConfigReader().getDriverPath() + "/msedgedriver.exe");

                //Creating an object of EdgeDriver
                driver = new EdgeDriver();
                driver.manage().window().maximize();

                //Deleting all the cookies
                driver.manage().deleteAllCookies();

                //Specifiying pageLoadTimeout and Implicit wait
                driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
                driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

I have used above code to achieve above scenarios. But 2 edge browsers are getting open and nothing is happening because of above code snippet and Step 1 is required to open ABC.lnk and application opens in edge browser on click on it.

And I have to perform automation on open browser through ABC.lnk click.

How can I perform automation in same edge browser open in step 1.

Thanks in advance.

0 Answers
Related