Pages

Search This Blog

Tuesday, August 24, 2010

How to get browser name, version and operating system detail in selenium

We can get the browser name, version and operating system name and version with the following commands in selenium RC.
Below code is tested in Mozilla Firefox
Browser Name

System.out.println(selenium.getEval("navigator.appCodeName;"));

Mozilla

Browser version

System.out.println(selenium.getEval("navigator.appVersion;"));

5.0 (Windows; en-US)

Browser and Operating system detail

System.out.println(selenium.getEval("navigator.userAgent;"));

Result.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)

String browser = selenium.getEval("navigator.userAgent");
if (browser.contains("Firefox")  || browser.contains("Chrome")) {


6 comments:

  1. After I originally commented I seem to have clicked on the
    -Notify me when new comments are added- checkbox and now whenever
    a comment is added I get four emails with the same comment.

    Perhaps there is an easy method you can remove me from that service?
    Thanks!
    Here is my web blog http://fcc.gov

    ReplyDelete
  2. I'm really enjoying the design and layout of your site. It's a very easy
    on the eyes which makes it much more pleasant for me to come here and visit more often.

    Did you hire out a designer to create your theme? Outstanding work!


    Take a look at my homepage ... themes

    ReplyDelete
  3. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium.
    Selenium

    ReplyDelete
  4. It was very nice blog to learn about SAP BASIS. Thanks for sharing.SAP basis

    ReplyDelete
  5. It was very nice blog to learn about Selenium.Thanks for sharing new things.selenium training in chennai

    ReplyDelete