Thursday, July 23, 2015

Using the Microsoft Driver for Microsoft Edge




As the release of Windows 10 has approached, I've been seeing more and more questions about a WebDriver implementation for Microsoft Edge (nee "Spartan"). So far, I've only been able to say that there isn't a driver implementation for that particular browser, and that there is no work being done in the open-source arena on such an implementation. Furthermore, that Microsoft has acknowledged the need for such a driver and has committed to providing one, but has provided no timetable for a release of such an implementation.

As of today, I can say much more than that.

Today, Microsoft has announced the availability of a WebDriver implementation for Microsoft Edge. This implementation is released as an installable application for Windows 10, and you can download the installation package here. While the requirement to run an installer might be off-putting to some users, it appears that the installation package merely installs a standalone executable to the restricted "Program Files" location. As near as I can tell by examining the installer package, the executable can be freely copied to other locations on the machine after installation. Also, the use of an installable package means the executable can be serviced and updated by the standard, automatic Microsoft Update mechanism.

The last point is incredibly important. This first release of a driver from Microsoft is most emphatically not a finished release, and as such it lacks functionality, some of it rather basic. To wit, finding an element within the context of another element (i.e., WebElement.findElement) is not yet implemented in the current release. Finding an element via XPath is not implemented in this first release either. Switching to frames or iframes (i.e., driver.switchTo().frame()) is likewise not implemented in this initial release, and neither is the advanced user interactions API (i.e,. the Actions class). In fairness, Microsoft has been completely forthcoming in what functionality the driver has implemented and what is missing. I fully expect that the driver will be receiving regular updates, and that the missing functionality will be added in the coming weeks and months.

So, how does one use the Microsoft Edge driver? Well, thanks to our good friends in Redmond, the release of the driver implementation was accompanied by a pull request to the Selenium project that enables the existing language bindings to use it seamlessly. The Edge driver as currently released uses the open-source project's dialect of the WebDriver JSON wire protocol, allowing us to use the driver right now. My guess would be that a future release of the driver will use the W3C specification version of the protocol. The pull request has been merged, so all you'll need is an updated language binding release, and you'll be able to use it directly. If you're itching to use it in the meantime, you can manually launch MicrosoftWebDriver.exe, and use the RemoteWebDriver class in your current language bindings to connect to it on your local Windows 10 machine.

Congratulations to the Microsoft Edge development team for releasing a standard tool for automating Microsoft Edge. I, for one, appreciate the hard work and efforts you've put forth to make this happen. I look forward to future enhancements and features, and I stand ready to help any way I possibly can.