Note: This post was triggered by a blog post on David Burns’ Blog which states that FirefoxDriver will stop working at version 47 of Firefox.
It is easy to switch to using the new
- I suggest you try it on your code, and if your tests work, then keep using it.
- If your tests fail, then it is most likely some defects in the newer
MarionetteDriver. In which case:
Steps to switch:
- Download the marionette driver
- Unarchive it to a folder of your choice
- In your code set the
"webdriver.gecko.driver"property to the location of the
- Use the
The above is slightly different from the official instructions on the page.
The official instructions suggest you:
- rename the file to ‘wires.exe’ and
- add it to your path.
I did rename it to
wires.exe, mainly to keep the code consistent so I wouldn’t have to update the code everytime I change the version of the marionette driver.
But I didn’t add it to the path. I’d rather control that in the code when the option is provided.
Firefox 45 and 46 my start driver code looks like this:
WebDriver driver = <span class="hljs-keyword">new</span> FirefoxDriver();
Firefox 47 and above my code looks like this:
<span class="hljs-keyword">String </span>currentDir = System.getProperty(<span class="hljs-string">"user.dir"</span>)<span class="hljs-comment">;</span> <span class="hljs-keyword">String </span><span class="hljs-keyword">marionetteDriverLocation </span>= currentDir + <span class="hljs-string">"/tools/marionette/wires.exe"</span><span class="hljs-comment">;</span> <span class="hljs-label">System.setProperty</span>(<span class="hljs-string">"webdriver.gecko.driver"</span>, <span class="hljs-keyword">marionetteDriverLocation); </span><span class="hljs-label">WebDriver</span> driver = new <span class="hljs-keyword">MarionetteDriver(); </span>
I have a working example of this in the
startUsingSeleniumWebDriver code on github: