Page 1 of 1

which Brwoser is currently active?

Posted: Tue May 06, 2014 10:52 am
by thecrazykaktus
Hi people,


can any one tell me how I can check which Browser is currently active?
I want to check if just the IE or Firefox is active.

How can i do that?

Thanks.

Re: which Brwoser is currently active?

Posted: Wed May 07, 2014 9:08 am
by Support Team
Hello thecrazykaktus,

You can for example use the "Get Value" action as shown in the image below.
GetBrowserName.jpg
Another way to check the browser is using the WebDocument class.
Please take a look at the sample code below.
WebDocument browser = repo.YourRepoItem.AbsoluteBasePath.ToString();

if(browser.BrowserName.Equals("IE"))
{
	Report.Info("IE is active");
}
else if(browser.BrowserName.Equals("Mozilla"))
{
	Report.Info("FF is active");
}
Regards,
Bernhard

Re: which Brwoser is currently active?

Posted: Wed May 07, 2014 12:10 pm
by thecrazykaktus
Thanks, it works fine!