If you have created some client functionality that is triggered when the user moves the mouse over an element, you may run into trouble testing with Selenium’s mouseOver method.

I recently implemented such a feature using jQuery’s hover event handler and pulled my hair out trying to test the functionality with Selenium. I went down a complete rat hole trying trigger the event within selenium using the getEval method and passing in custom javascript code. What a nightmare. That is, until I really sat down and thought about it.

Remember that Selenium doesn’t actually control the pointer in the browser but drives the browser through javascript. Therefore, unlike a true mouse event that may trigger a number of events, Selenium’s mouseOver just triggers mouseover on the element. Now, if you have used jQuery’s hover then you are binding your functionality to mouseenter and mouseleave not mouseover and mouseout.

Therefore, if you wish to test with Selenium, do not use jQuery’s hover method and bind your functionality to mouseover and mouseout.

Note that many older browsers do not support mouseenter and mouseleave as this was introduced by Microsoft and was not immediately adopted by the others. There is also a big difference in their behaviour and propagation in the event model. mouseover and mouseout bubble up whereas mouseenter and mouseleave do not bubble up.

With JQuery UI Tabs v.3 there isn’t an option to make the tabs bookmarkable. In other words when you click on the tabs the URL does not change therefore you can’t link or bookmark anything other than the default tab.

Here is how I solved the problem… [UPDATED!]

Continue reading »

© 2012 rootsmith blog Suffusion theme by Sayontan Sinha