How to properly close the chrome Browser making sure that it is not even running the background

Ask general questions here.
premravi
Posts: 78
Joined: Tue Jan 08, 2019 1:55 pm

How to properly close the chrome Browser making sure that it is not even running the background

Post by premravi » Thu Apr 18, 2019 2:53 pm

Hi,

I am struggling to close the browser in a decent way so that it will not run continue running in the background

I tried :
1. Host.local.KillBrowser
2. foreach (WebDocument dom in Host.Local.Find<WebDocument>("/dom[@browsername='Chrome']"))
dom.close();
3. Host.local.CLoseApplication("ProcessId") >>>> Not sure how to get the processId , moreover if we get also do not know how reliable it will be, but please let me know how to get the processId
4. I turned off the google Advanced settings of "Continue running apps when google chrome is close"

Tried with all the above ways to make sure the chrome is closed properly without running in the background but no luck

Please help me with an approach wherein chrome gets closed successfully even from the background also (Task Manager) so that no restore pop up message will appear the second when we launch chrome

Please refer the attached screenshot

Regards

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to properly close the chrome Browser making sure that it is not even running the background

Post by odklizec » Thu Apr 18, 2019 3:16 pm

Hi,

Unchecking "Continue running background apps when Google Chrome is closed" should definitely stop running Chrome in background. So once the Chrome is closed from Ranorex (and the option is disabled), Chrome should be terminated for good. I'm using this approach in various projects and everything works as expected?

What happens, if you uncheck this option and then close Chrome manually? Does it disappear from Task Manager?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

premravi
Posts: 78
Joined: Tue Jan 08, 2019 1:55 pm

Re: How to properly close the chrome Browser making sure that it is not even running the background

Post by premravi » Thu Apr 18, 2019 3:19 pm

Hi,

I thought the same,

But checking that box also I am getting Restore pop up in my browser

There is not problem in handling actually I am using popup watcher for that

But here the point is why is it coming as it is checked in the settings

Moreover which approach to use to close the browser ?

Please suggest

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to properly close the chrome Browser making sure that it is not even running the background

Post by odklizec » Thu Apr 18, 2019 3:30 pm

Hi,

The 'restore' popup is unfortunately a Chrome-related problem and I found no other solution than using popupwatcher as well. Generally speaking, we should close browser via [x] button and not KillBrowser or kill process, which may terminate browser ungracefully and therefore Chrome issues this message. But I occasionally saw this popup even after closing Chrome via [x] button. So popupwatcher is probably the best workaround ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration