16

Last weeks there has been a lot of noise about this new FirefoxDriver called Marionette. To use Firefox with Selenium, we used to use the "old" Selenium FirefoxDriver. From Firefox 48.0 onwards it is going to be required to use this new FirefoxDriver developed by Mozilla.

I understand it is required to change to that direction to get every browser supports and develops its drivers and to get drivers independent of Selenium. Besides, it is supposed if Mozilla develops its own driver, it will be faster and easier to fix issues and to develop features.

My question is, for those who create automated tests using Selenium framework, is there any benefit of using Marionette instead of the "old" Selenium supported FirefoxDriver? _(Such as a better performance, a better compatibility...)

Tarun
  • 3,456
  • 10
  • 48
  • 82
Lorenzo Fidalgo
  • 203
  • 2
  • 8
  • 4
    Potential close voters who might be tempted to assume the question is "too broad." It's not. There is a simple and technical reason why this new approach is required. I've outlined it in my answer. – JimEvans Aug 12 '16 at 11:48

1 Answers1

31

The main advantage for using the Mozilla-provided, Marionette-based Geckodriver solution is that it works for versions of Firefox 48 and higher. The legacy driver provided and maintained by the Selenium project doesn't work for Firefox 48 or higher, and will never work for those versions of Firefox.

The legacy driver is implemented as a Firefox extension. This extension is installed in the profile used by the driver when WebDriver launches Firefox. Firefox 48 introduced two new features that disabled this browser extension. The first is the so-called "electrolysis" feature, or multiprocess Firefox. Electrolysis changes the way extensions have to deal with the browser in ways the Selenium team has not taken the time to fully understand.

The second, more important requirement is that all browser extensions must be signed by Mozilla before the browser will allow them to load. This latter feature has been in Firefox for several versions, but beginning with 48, it can no longer be disabled. The WebDriver browser extension introduces several valid security concerns for the Firefox browser, and as such, will not be signed by Mozilla's security team. This, in turn, renders the extension inoperable, and thus Selenium can no longer communicate with Firefox. The Marionette-based solution, being developed and maintained by Mozilla in the first place, is blessed by them for use in automating Firefox, and as such carries a commitment that it will continue to work with future versions moving forward.

So the primary benefit of using Marionette with Firefox 48 and higher is that it will work, whereas other solutions won't.

JimEvans
  • 27,201
  • 7
  • 83
  • 108
  • if Marionette-based Geckodriver is not gonna be used as an extension for Firefox, what would be it's mechanism to drive firefox? any simple example pls.. Any small idea on Electrolysis in Marionette driver would be fine; like how the driver take over the Firefox browser. – Prashanth Sams Aug 13 '16 at 07:47
  • 2
    The mechanism used to drive the browser is now part of Firefox itself. It's built into the browser, which is why it's maintained by Mozilla. Their driver code is entirely [open source](https://github.com/mozilla/geckodriver), and the `geckodriver` executable provided by them acts as a translator to take the HTTP calls from WebDriver to use a Marionette communication protocol over TCP that the browser understands natively. If you're using Selenium, however, there is no need for the user to care about the specifics; it will work using the same code that worked before. – JimEvans Aug 13 '16 at 11:55
  • @JimEvans I found selenium 3 is using marionette driver by default. So how could things work with an existing set of code. [I am facing a similar issue](http://stackoverflow.com/questions/40086011/how-to-set-a-specific-download-location-in-mozilla-marionette-web-driver) – Surabhil Sergy Oct 18 '16 at 08:28