I have a Selenium project using Java that uses different browsers. I'm trying to introduce MS Edge, but having trouble using the getVersion() method from Capabilities. Below is a code snippet from a method that initializes the browser. WebDriver "driver" is declared at the beginning of the class.
if(strBrowser.equalsIgnoreCase("Edge"))
{
String FileName=m1.get("TOOLS_PATH").toString()+"//MicrosoftWebDriver.exe";
System.out.println("Full path to Edge executable: " + FileName);
File edgeDriver = new File(FileName);
System.setProperty("webdriver.edge.driver", edgeDriver.getAbsolutePath());
DesiredCapabilities caps = DesiredCapabilities.edge();
driver = new EdgeDriver(caps); //launches Edge browser
}
Capabilities caps = ((RemoteWebDriver) driver).getCapabilities();
String browserName = caps.getBrowserName();
String browserVersion = caps.getVersion().toString();
During debugging in ecliipse, when I hover on the 'caps' object after initializing it, it shows me the following: Capabilities [{acceptSslCerts=true, browserVersion=25.10586.672.0, platformVersion=10, browserName=MicrosoftEdge, takesScreenshot=true, pageLoadStrategy=normal, takesElementScreenshot=true, platformName=windows, platform=ANY}]
The string browserName comes out to be "MicrosoftEdge", but browserVersion comes out empty. I'd expect that it'd come out to be "25.10586.672.0"