Getting the Browser details in Selenium

There are times when you would like to get the browser details when running the selenium scripts. Here is the selenium script that you can use to to get browser details.

String a = selenium.GetEval("navigator.appCodeName");
Console.WriteLine(a);
String b = selenium.GetEval("navigator.appName");
Console.WriteLine(b);
String c = selenium.GetEval("navigator.appVersion");
Console.WriteLine(c);
String d = selenium.GetEval("navigator.cookieEnabled");
Console.WriteLine(d);
String e = selenium.GetEval("navigator.platform");
Console.WriteLine(e);
String f = selenium.GetEval("navigator.userAgent");
Console.WriteLine(f);

The Results as under for the above code when the script is run of firefox version 3.5.7.
Mozilla
Netscape
5.0 (Windows; en-GB)
true
Win32
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7

How did this solution work for you? Do you have a better alternative? Feel free to share your thoughts in comments section below.

[ad#PostAD]

One thought on “Getting the Browser details in Selenium

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>