Reputation: 107
Trying to write the browser name and version number to the console with the following code:
DesiredCapabilities test = DesiredCapabilities.internetExplorer()
String browserName = test.getBrowserName();
String ver = test.getVersion();
System.out.println(browser name + " v: " + ver);
This would print the following:
internet explorer v:
the ver doesn't hold any version number - any ideas why?
Upvotes: 1
Views: 146
Reputation: 6962
Try getting your capabilities and then using the object of getCapabilities()
print your browserName and browserVersion. Try this way -
Capabilities cap = ((RemoteWebDriver) driver).getCapabilities();
String browserName = cap.getBrowserName();
String ver = cap.getVersion();
System.out.println(browser name + " v: " + ver);
Your code is for getting the capabilities of IE Driver only and this one is universal to all drivers. Hope this helps.
Upvotes: 1