Category Archives: Firefox

Using Portable Firefox 46 with WebDriver

As mentioned on David Burns’ blog and in a previous post here 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
    • pom.xml
    • src
  • 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.

I have updated my ‘start using selenium webdriver’ github repo to have examples of the different approaches for instantiating Firefox.

 

Posted in Firefox, Selenium Simplified Blog, WebDriver | Leave a comment

Problems running WebDriver on Firefox 26?

The Issue

I had a quick look at version 26 of Firefox today, because a fair few people contacted me, saying they had been having issues with it.

Based on forums and calls for help, these people weren’t the only ones.

But, not everyone is experiencing the problem, so there is something odd going on.

I could experience the problem on my main Windows 8 machine, but I hadn’t noticed, because I hadn’t upgraded to version 26 of Firefox.

First the Workaround

The fix I used was to downgrade my version of firefox to 25.0.1

And WebDriver worked fine for my basic test, I tried WebDriver versions 2.38.0 up to version 2.40.0.

I installed Firefox version 27.0b2, and it failed with the same problem I experienced with version 26.

I don’t know the root of the problem I’m experiencing, but my workaround will be to stick on Firefox 25 for my automation work.

Remember to use the Firefox Options \ Upgrade, and set it to not upgrade.

The Salutary Lesson

This might seem extreme, but when doing automation, we need to control the versions of software we test with. If you allow your browser to automatically update without your knowledge then you don’t know if your automation fails because of something you did, or something environmental.

Control of your environment means that when a problem happens, it is most likely something you did.

Given that other people have managed to get WebDriver working with Firefox 26. It might be an operating system based issue, or a plugin issue, or a heaven-knows-what issue.

Summary

When faced with problems like these:

  1. Check if anyone else is having the problem
  2. Did anyone find a solution? Try it.
  3. Find a workaround. (First try downgrading to a known working state)
  4. Investigate roll forward options

If execution against version 26 is important to you, try running Firefox on a VM with a different operating system, perhaps from modern.ie. Or try running against Saucelabs.

But DO. DO keep control of your execution environments and the software versions running on them.

Posted in Firefox, Selenium Simplified Blog, WebDriver | 16 Comments

FAQ: Why has my Firefox Selenium WebDriver Browser Not Closed

A few FAQs come up on the Start Selenium Simplified course. When they do, it usually means that I haven’t done a good enough job of making the answer visible the first time I address it.

One that crops up a lot is “Why is my browser not closing?”

Because WebDriver has two methods:

  •  .close
  • .quit

The documentation for .close says that it will close the browser if it is the last window that is closed.

For the last few Firefox where to buy inderal online releases, this does not happen.

Therefore we use .close, and .quit.

Use .quit when you know it is the last window you are working with. Or if you are working with a Driver Manager abstraction then you might want to stick the .quit in a JVM Shutdown.

I don’t know the reasons why, I haven’t spent the time investigating. But the workaround is to use .quit to finish with the driver.

 

Posted in FAQ, Firefox, Java, Selenium Simplified Blog, WebDriver | Leave a comment