After launching the application window get minimized and not showing any window then how to get that application open?
Need to switch to the opened application. But I see no reasons for the application to be minimized unless it does from you code.
////>>>>>>>> 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.");
}