How to close all chrome browsers before stopping robot

Hey @anhth15
There is good way only to kill the chrome browser process as you also have mentioned all chrome browser not tabs.
So if you will use hot key approach then their will be things like

suppose if you are dealing with 2 chrome browser then you have to send hotkey alt+f4 to both windows then selectors and attache browsers you have to deal with carefully.

the other thing ctrl+W will close only the current tab not a chrome browser having multiple tabs. Although if their will be only one tab then it will close that tab and browser as well but again the same problem to deal with two with selectors and containers.

so IMHO process kill will work best in this scenario. No selectors and containers dependency will be there.

and if you are using process kill approach then there you have to terminate it forcefully by passing /F arguement if you will not pass then it will kill only one chrome process so in one shot if you want to kill all chrome browser instances you have to kill the chrome process forcefully. :slight_smile:

Process [] chromeInstances = Process.GetProcessesByName("chrome");

foreach(Process p in chromeInstances)
p.Kill(); 

Note - to close all chrome browser instances one hot key solution is to use ctrl+shift+q.

Regards…!!
Aksh

4 Likes