I'm using Ruby
and Cucumber
to functionally test a web application. I am using watir-webdriver
to drive the web browser.
My web application has a navigation menu that includes a navigation link which displays a menu of options when hovered over.
I am trying to the watir-webdriver element.hover method to fire the hover event. The version of watir-webdriver in Ruby gems doesn't seem to currently contain this commit to add a hover event to an element however, I monkey patched the element class to add this functionality.
When running my tests on my Mac, using Chrome, everything is fine. The hover even is fired and I am able to click a link in the resulting menu that is displayed.
When I set up the Ruby environment on a colleague's Windows machine however, we do not get the same results. Using Firefox, the hover event does indeed fire, however, only for a split second and then the drop down menu disappears. This causes the test to fail as the following cucumber step tries to click a link that exists on the drop down menu, which no longer exists.
So my question is this:
Does anyone know how, on Windows, when using Cucumber and watir-webdriver, how I can ensure that a hover state remains after calling element.hover?