Explaining how the real world works!     RSS Feed The Automated Tester on Twitter The Automated Tester on LinkedIn The AutomatedTester on github

Marionette - The Future of FirefoxDriver in Selenium

Wed 25 Jul 2012

We all know that Selenium WebDriver is on track to becoming a W3C standard. First we saw this happen with Opera who have integrated this with their browser when they created OperaDriver. Google Chrome followed with the release of their ChromeDriver executable. This is a separate download to the browser and client bindings. So who is next? Mozilla.

Why do we need a new FirefoxDriver for Selenium?

Mozilla has been working on a project called Marionette which will become a future version of FirefoxDriver. Marionette was created as a way to automate Firefox OS, since Firefox OS is just a kernel then starts up Gecko, the core engine of Firefox. I appreciate that is overly simplified but for now it all that we need to know. Firefox OS did not have a mechanism that allows Firefox extensions, when the work started on Marionette, to be installed which means that the current way that FirefoxDriver works by installing an extension and updating preferences on start-up will not work.

I have been working on Mozilla Open Web Apps project as one of my many things. This is a project that allows you to install web applications natively on to your OS and then use them like native applications. This relies on AppCache and other offline tricks but when you start the installed version of a web application you will not have access to extensions either. So both Firefox OS and Open Web Apps both block the current approach that FirefoxDriver has.

So in step the Automation and Tools Team, affectionately known as the A-Team internally at Mozilla, and more specifically Malini Das and Jonathan Griffin. They started working on a way to get an automation framework and build system going. Malini and Jonathan started working from the Selenium JSON Wire Protocol to create Marionette so that it can fit in with our plans for making Selenium a W3C Standard. Malini and Jonathan have stabilised Marionette for the current need in the Firefox OS project. I have been working to try to stabilise the desktop version, purely for my own needs on the Open Web Applications project at the moment but we be trying get this as complete as possible in the next couple of quarters.

How does it work?

Marionette works by using the socket transport of the JavaScript remote debugger as the JavaScript Remote debugger that is coming to Firefox. This just opens a socket in the browser that we then connect to and pass through commands that we want the browser to do. Does that mean that the JSON Wire Protocol isn't followed exactly? Yes, we have created our own take on the JSON Wire Protocol mainly just to fit in with the transportation mechanism that we are using. Since this is just a socket one could open a telnet connection to the browser and just send the commands. It is an extremely lightweight approach when we come to mobile and therefore benefits desktop implementations.

Does it only work on web content?

No! Marionette can also work against the browser chrome. Marionette is ultimately going to be the central item when it comes to automation frameworks within Mozilla. All of which are homegrown since we have unique requirements. We need to make sure that what we can do at least most of their functionality via Marionette if not all of it.


With Marionette being maintained in-house by the people that know the browser best, and being part of Mozilla build process, if Marionette gets broken it will get backed out very quickly. That means FirefoxDriver is going to be part of the Mozilla build process!

So when can I play with it? It is available now as part of Firefox debug builds. Why only debug builds? It still has to go through our security review since just having an open socket can drive the browser is quite scary and an opportunistic hacker could just run a selenium script and steal details. It will probably be preferenced off to start but is still a potentially scary problem.

    Area: blog

blog comments powered by Disqus