Friday, May 20, 2011

Selenium commands to get browser name, browser version , operating system and few more

Browser name : selenium.getEval("navigator.appName;") returns the name of the browser.

Browser code name : selenium.getEval("navigator.appCodeName;") returns the code name of the browser.

Browser version : selenium.getEval("navigator.appVersion;") - The appVersion property is supported in all major browsers and it returns the version of the browser.

Browser and Operating system : selenium.getEval("navigator.userAgent;") - This property returns the value of the user-agent header sent by the browser to the server.

Whether Java Enabled : selenium.getEval("navigator.javaEnabled();") - returns a Boolean value that specifies whether the browser has Java enabled.

selenium.getEval("navigator.platform();") - returns for which platform the browser is compiled

Check Cookie Enabled or not : selenium.getEval("navigator.cookieEnabled();") - returns a Boolean value that specifies whether cookies are enabled in the browser.

1 comment:

  1. Hi Krishna,
    I am using Selenium version 2.40 in Java, and have following libraries:
    import org.openqa.selenium.*;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.ie.InternetExplorerDriver;
    import org.openqa.selenium.support.ui.Select;
    import org.openqa.selenium.Capabilities;
    import org.openqa.selenium.remote.RemoteWebDriver;

    I am unable to use suggested method "selenimum.getEVal(...)". What library do I need to include to make it work?

    Thanks,
    Vinay

    ReplyDelete