Closing the Edge Browser

Ask general questions here.
loonquawl
Posts: 69
Joined: Wed Nov 22, 2017 10:08 am

Closing the Edge Browser

Post by loonquawl » Mon Jul 01, 2019 7:32 am

I'm trying to close the Edge Browser.
Opening it via 'OpenBrowser' works, and the Website can be interacted with and tracked as normal, but if I try to Spy or Track the Browser itself (for instance the close-button in the upper righthand corner) it does not work well (the red frames that show what item was tracked do not appear for most elements). I cannot use CloseApplication, as i do not seem to have an element that works as an input (the Action is completetd without error, but Edge stays open)

Anybody have a solution?

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

Re: Closing the Edge Browser

Post by odklizec » Mon Jul 01, 2019 9:42 am

Hi,

Close Application should work just fine, as long as you assign it with DOM repo element. At least it works for me?
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

natesun
Posts: 14
Joined: Wed Oct 17, 2018 4:05 pm

Re: Closing the Edge Browser

Post by natesun » Thu Aug 29, 2019 5:41 pm

Hi,

I have similar issues, when directly setting Host.Local.OpenBrowser() and overwrite killExisting to true, edge does not close.

When trying to get doms by using Host.Local.FindChildren<Ranorex.Webdocument>(), Edge would close but opens again. Is this a bug within Ranorex or do I miss anything?

Thanks,
Nate

YvesL
Posts: 12
Joined: Mon Jan 13, 2020 2:20 pm

Re: Closing the Edge Browser

Post by YvesL » Wed Mar 24, 2021 12:27 pm

I also have this issue with Edge: the browser does not close, while the same method works with IE, Chrome and Firefox.

I use this C# code to close the browsers: (NB: "FindChildren" method is deprecated, so I use "Find")

IList<Ranorex.WebDocument> webList = Host.Local.Find<Ranorex.WebDocument>("/dom");
foreach (Ranorex.WebDocument webdoc in webList)
{
Report.Log(ReportLevel.Info, "Closing browser window for: " + webdoc.BrowserName);
webdoc.Close();
}