WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

After launching the application window get minimized and not showing any window then how to get that application open?

Open VishGJadhav opened this issue 1 year ago • 2 comments

VishGJadhav avatar Aug 26 '24 05:08 VishGJadhav

Need to switch to the opened application. But I see no reasons for the application to be minimized unless it does from you code.

anunay1 avatar Aug 30 '24 16:08 anunay1

////>>>>>>>> This code for 1st application AppiumOptions desiredCapabilities = new AppiumOptions(); desiredCapabilities.AddAdditionalCapability("app", @"C:\Program Files (x86)\Symtrax\Compleo Hybrid\XMLMapperV6.exe");

            CompleoXmlSession = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), desiredCapabilities);
            Assert.IsNotNull(CompleoXmlSession);
            var currentWindowHandle = CompleoXmlSession.CurrentWindowHandle;
            Thread.Sleep(TimeSpan.FromSeconds(15));
            var allWindowHandles = CompleoXmlSession.WindowHandles;

            CompleoXmlSession.SwitchTo().Window(allWindowHandles[0]);

//////>>>>>> This is for 2nd application AppiumOptions ao = new AppiumOptions(); ao.AddAdditionalCapability("app", @"C:\Program Files (x86)\Symtrax\Compleo Hybrid\AdminSupervisor.exe"); ao.AddAdditionalCapability("ms:waitForAppLaunch", $"{30}"); ao.AddAdditionalCapability("ms:experimental-webdriver", false);

                supervisor = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), ao);
                Thread.Sleep(TimeSpan.FromSeconds(10));
                //supervisor.Manage().Window.Maximize();
                var process = Process.GetProcessesByName("AdminSupervisor").FirstOrDefault();
                IntPtr hWnd = FindWindow(null, "Symtrax - Compleo Supervisor");
                if (process != null)
                {
                    // Bring the process window to the front
                    SetForegroundWindow(process.MainWindowHandle);
                    SetForegroundWindow(hWnd);
                    //IReadOnlyCollection<string> windowHandles = supervisor.WindowHandles;
                    supervisor.SwitchTo().Window(supervisor.CurrentWindowHandle);
                }
                else
                {
                    Console.WriteLine("Process not found.");
                }

VishGJadhav avatar Sep 02 '24 04:09 VishGJadhav