Over a million developers have joined DZone.

Using Portable Firefox 46 With Webdriver

Need to use the portable version of Firefox 46 with webdriver? Alan Richardson gives you a code snippet to use to get it working without using Marionette!

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

As mentioned on David Burns’ blog and in a previous post Firefox are moving towards Marionette driver. At the time of writing Firefox 47 doesn’t work with FirefoxDriver and you need to use Marionette. This may change back soon, and David’s blog post might no longer be available.

As mentioned on the above posts you can use Marionette, or use the ESR.

OR you could use a portable version of Firefox.

Rather than try and toggle multiple versions of Firefox. I downloaded a portable version of Firefox. I used a version distributed by portableapps.com. Having a portable app means I can run 46 and 47 at the same time and don’t have to uninstall 47 to use 46. The portable app puts all its DLLs in the app folder and doesn’t really ‘install’ it mostly un-archives itself.

On the sourceforge site for portableapps they have a set of older Firefox versions:

I downloaded a version of Firefox 46.0.1

I extracted/installed this to my ‘tools’ folder which is a peer of my ‘code’ folder:

  • code
  • tools
    • chromedriver
    • marionette
    • iedriver_64
    • etc.

And now I have a FirefoxPortable folder in my tools folder.

When I instantiate a FirefoxDriver I no longer write:

WebDriver firefox = new FirefoxDriver();


Because that would trigger the “Firefox is no longer working” error.

Instead, I tell the FirefoxDriver which executable to use:

FirefoxProfile profile = new FirefoxProfile();
firefox = new FirefoxDriver(
                 new FirefoxBinary(
                     new File(System.getProperty("user.dir")+
                     "/../tools/FirefoxPortable/FirefoxPortable.exe")
                  ), 
               profile);



And then I can run my @Test code as normal without having to use Marionette.

Obviously, you can abstract this instantiation into a class so you don’t have to change code everywhere.

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:
app ,folder ,driver ,versions ,portable ,marionette ,version ,tools ,firefox

Published at DZone with permission of Alan Richardson, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}