TLDR; Selenium 3 WebDriver is pretty much a drop in replacement for Selenium 2 WebDriver
The 3.0.0 Beta v1 version of WebDriver has been released and my first Impressions of Selenium 3 beta are very good.
And first impressions means, can I run the stuff I have already.
I amended the
pom.xml to bring the release down from maven central.
<!-- <webdriver.version>2.53.1</webdriver.version> --> <webdriver.version>3.0.0-beta1</webdriver.version>
So I effectively included it as
<dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-server</artifactId> <version>3.0.0-beta1</version> </dependency>
Since WebDriver now needs Java 1.8 so I’ll bump the language dependencies in
<configuration> source>1.8</source> <target>1.8</target> </configuration>
In my test code I’ve been using a base64 encoding implementation bundled with Selenium, for working with screenshots
Since WebDriver now needs Java 1.8, I’ll just use the decoder in Java 1.8 instead
//Base64 decoder = new Base64(); //byte imgBytes = (byte) decoder.decode(tempImageFileAsBase64); byte imgBytes = Base64.getDecoder().decode(tempImageFileAsBase64);
With WebDriver 3.0.0-beta1 on Windows 10
- FirefoxDriver && Firefox 47.0.1 - all tests passed
- ChromeDriver v2.22.397933 && Chrome Version 52.0.2743.82 m - all tests passed
- IEDriverServer (32 bit) v2.53.1 && IE 11.494.10586- 1 test failed
- HTMLUnit 2.21 - 28 tests failed
- Marionette v 0.9.0 (64 bit)&& Firefox 47.0.1 - 65 tests failed
- Edge v 10586- 70 tests failed
3.0.0-beta1 defaults to Marionette, so to use the internal
FirefoxDriver we can
set a capability
DesiredCapabilities legacyCapabilities = DesiredCapabilities.firefox(); legacyCapabilities.setCapability(“marionette”, false); WebDriver aDriver = new FirefoxDriver(legacyCapabilities);
Code suggests that the plan is to allow us to:
- set a system property “webdriver.firefox.marionette”
But I couldn’t get that to work:
It doesn’t look like that has been coded for yet. Although I can now see that this was present in 2.53.1 as well (I didn’t notice that before)(I couldn’t get it to work in 2.53.1 either).
So - set the capability for now to switch between Marionette and legacy driver in Selenium WebDriver 3.0.0-beta1.
MarionetteDriver that I’ve been using will be deprecated and we’ll use the
FirefoxDriver for both Marionette and Legacy - with just a toggle of the capability.
And with that I guess I’m ready to migrate to 3.0.0 when it moves out of beta.
Pretty much the drop in replacement that the selenium team have been working towards. Another A+