Selenium 2 asks, "What Browser are you?"
If you have a test that is curious about what browser type or version is running it is possible to have it ask the browser what it is.
Perhaps the layout of the page changes or the content based on the version of the browser and different locators need to be built for different types or versions.
String userAgent = (String) ((JavascriptExecutor)driver).executeScript("return navigator.userAgent;");
System.out.println(userAgent);
Now that you have the user agent, you need to interpret the user agent into the proper action.
selenium@lmnsolutions.com

No comments:
Post a Comment