简体   繁体   中英

How is it possible to terminate a Chrome Application, that ist not launched via “Launch” activity, but from another application like Powershell?

When I launch an application via navigate stage and launch action, there are no problems to terminate the application. Currently I am working on a process, that launches Chrome via Powershell. When I am trying to terminate/ close the application, one chrome process is closed. But there are 10 chrome processes in task manager. The chrome-window is not closed.

Here's what I've already tried: - using navigate stage and terminate action - identify the window by using win32 mode and afterwards the close action in a navigate stage - invoke JS fragment: window.close() -> returns, that only windows that have been opened with code can also be closed with code

So what else may I try?

You can also use the action "Kill Process" within the Utility - Environment VBO to target all open instances of the chrome.exe process.

You can always invoke taskkill from the command line (or PS):

taskkill /IM chrome.exe /F

This c# should close every instance of Chrome running (using System.Diagnostics). Place it in a code stage:

        Process[] processes;
        string procName = "chrome";
        processes = Process.GetProcessesByName(procName);

        foreach (Process proc in processes)
        {
            proc.CloseMainWindow();
        }

If you don't know how, you can see another one of my answers here .

This powershell on line will kill all of your chrome process

get-process chrome | stop-process

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM