which Brwoser is currently active?

Class library usage, coding and language questions.
thecrazykaktus
Posts: 13
Joined: Wed Feb 19, 2014 11:24 am

which Brwoser is currently active?

Post by thecrazykaktus » Tue May 06, 2014 9:52 am

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12016
Joined: Fri Jul 07, 2006 3:30 pm
Location: Graz, Austria

Re: which Brwoser is currently active?

Post by Support Team » Wed May 07, 2014 8:08 am

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
You do not have the required permissions to view the files attached to this post.
.
Image

thecrazykaktus
Posts: 13
Joined: Wed Feb 19, 2014 11:24 am

Re: which Brwoser is currently active?

Post by thecrazykaktus » Wed May 07, 2014 11:10 am

Thanks, it works fine!