I do all this through a python on a poppy. At the same time running chrome with a different profile. How to make a new chrome through Selenium immediately become an active window?

    1 answer 1

    • It is not clear what kind of selenium is meant. Web driver or the first.
    • It is not clear what language is used.

    Anyway. You want - I will give the answer to Sharp. Accordingly, it can be implemented only on the web driver.

    static void BringWindowToFront() { var currentProcess = Process.GetCurrentProcess(); var processes = Process.GetProcessesByName("имяПроцессаХрома"); var process = processes.FirstOrDefault(p => p.Id!=currentProcess.Id); if (process == null) return; SetForegroundWindow(process.MainWindowHandle); } [DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr hWnd); 

    It is my fault that you do not write the details. But your answer to the question itself is more than correct.