How to close all chrome browsers before stopping robot

Hi everyone,

I am finding solution to close all chrome browsers before stopping robot.
I found “Kill Process” activity but I don’t like to use it.
I wonder is there other way to achieve that.

Many thanks,
Hoang Anh.

Hi,

Wonder why you don’t like it?:thinking:

Other option would be:

  • shortcut key Alt+F4,Ctrl+w or
  • use attach/browser window variable in Close tab/Close window/Close application activities
1 Like

I too, never used it :open_mouth:
May be because it sounds like “force close”?
Is it the proper way to close applications (including browsers)?

2 Likes

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

If we kill chrome process from back end… google chrome may loose their plugins/add-in settings when we re open it.
this will not happen all machines but i found in some machines.

1 Like

This is really hard to get it. if you will kill a process then plugins will remove. it is the problem of extension coding or manifest.json of that extension at the time of development of that extension. i have developed in my early days.

Regards…!!
Aksh

if we don’t want to loose those plugins can we hardcode extension/plug-in details in Json file.
Could you please share those entries…

From my perspective it is not at all related with manifest json. it something else… you can check manually by killing process.

Just with a simple search found below links, Hope you will get something from these links,let me know as well

https://productforums.google.com/forum/#!msg/chrome/BRIjeE9dgRk/rlWWv_LZwRIJ
https://productforums.google.com/forum/#!topic/chrome/7oImEYDuQyE

By using Kill Process you risk having side effects because when chrome shuts down instantly it considers it not normal, and it will ask you to start from where you left the last time, that’s why I don’t personally use it so much

1 Like