Disabling native events when using Firefox with WebDriver

Imagine this, you’ve got a whole suite of regression tests (thousands of steps) written in Watir-WebDriver that you run on a corporate Windows XP SOE using Firefox.

The tests have been run numerous times and are running perfectly without any intermittent failures.

A new version of selenium-webdriver is released with promised bug fixes and stability improvements, so you update your selenium-webdriver gem to 2.6.0 and re-run your test suite.

Red light: half of the tests fail. The suite takes longer than ever to run. Oh my.

After some investigation, Jari Bakken points out that it’s Firefox native events related. This causes text field sets to take a long time if they include capital letters, and locating elements seems to often intermittently fail.

I add a config option to disable native events to my Firefox profile, and my tests run perfectly again. Phew!

So, if you’re using Windows and Firefox and come across any of these problems, include this code to disable native events when you start your browser.

profile = Selenium::WebDriver::Firefox::Profile.new
profile.native_events = false
Watir::Browser.new WEB_DRIVER, :profile => profile

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.

7 thoughts on “Disabling native events when using Firefox with WebDriver”

  1. This post has been such a god send today, after spending the last week rewriting our test suites in webdriver, i was struggling for a couple of days trying to get the buildserver to run the tests properly. This post has saved me hours of future struggling. thank you, great post, great help.


  2. Alister, a year and a half ago I used to work with Selenium 1.X on my old work. Now I started working as a QA engineer and your blog made me choose to work wtih Watir-Webdriver (+Selenium Grid, Cucumber/Spinach, and your page object framework) which has a better API.

    I came across the issue you described on a Ubuntu + Firefox setup. I disabled the native events and everything is working fine now. Thanks for sharing your knowledge.

    PyotrGalois from Argentina.



    BTW. Thank you.

    This cleared up not only script speed but a number of issues regarding DOM objects not being present/elements in cache not being found.

    Again, thanks so much.


  4. Alister,
    So is this an open bug in webdriver? I thought that using native events instead of js was one of the advantages to using webdriver over Selenium 1. Do you consider this a temporary fix, or is this something that you expect you’ll never use?



    1. Not really a bug.
      I wouldn’t ever use it as it causes me a large amount of grief in IE where you can’t disable it.
      I think it’s not a good thing to use, but there must be some benefit surely otherwise why would they have ever implemented it?


Comments are closed.