One of the differences between Watir and Watir-WebDriver is how elements are located. Watir-WebDriver was designe to store references to DOM elements previously used, and this can cause the stale ObseleteElementError exception, as I explained previously.
Watir-WebDriver 0.3.1 has recently been released, and now there is a configurable option to specify that you always want to create a fresh reference when using an element.
Watir::always_locate = true b = Watir::Browser.new
This will result in a performance hit, but in my experience, it isn’t too bad. Jari Bakken ran WatirSpec using this config which resulted in a 10 second increase in running time (from 145 seconds to 155 seconds) which in my opinion is worth it to have more reliable test results.
Thanks to Jari for working on this. Hope you enjoy.
Update: 15 August 2011: I only just realized this is enabled by default, so you’ll get it automatically when you update your gem. Neat.