Simply close the browser?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
roxter
Posts: 22
Joined: Thu May 12, 2016 10:18 am

Simply close the browser?

Post by roxter » Tue Oct 11, 2016 7:15 pm

Hi!
I am looking for a way to close my firefox browser withour knowing what content is currently presented.
There must be a simple way without even knowing the process ID I hope?
If I used recorded action I need to specify a repo item to perform the close action on.
Well the browser close action should work from any page... how to achieve this?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Simply close the browser?

Post by krstcs » Tue Oct 11, 2016 7:54 pm

Make a repo dom object that looks like this (Mozilla likes to do things differently... :S ):

/dom[@browsername='Mozilla']

You can then use that repo object to close any dom (web page) that is in a FF browser. You may want to do this in a loop in user-code though so you get all of them, if there is more than one, like below:

Code: Select all

foreach (WebDocument dom in Host.Local.Find<WebDocument>("/dom[@browsername='Mozilla']")) {
    dom.Close();
}
Shortcuts usually aren't...

roxter
Posts: 22
Joined: Thu May 12, 2016 10:18 am

Re: Simply close the browser?

Post by roxter » Tue Oct 11, 2016 8:54 pm

Thank you!