FireFox 8 and mouseover and/or clicking

413 views
Skip to first unread message

Chuck van der Linden

unread,
Dec 6, 2011, 6:08:25 PM12/6/11
to Watir General
Is anyone else suddenly discovering they have difficulty with scripts
using a click immediately following onmouseover / hover type events in
firefox 8? It's as if FF is reporting the true mouse position to the
app immediately after I've done something like a click/mouseover event/
hover and thus the client side code is un-rendering the control. as
a result I get exceptions for "Element not currently visible"

My particular situationis that II have some fancy pulldown menus in
our app that are a bit of a challenge to automate since they are very
event driven (pulling up the pop-down menus when you mouse over or
click on the menu name) I'd been working with them by using either
an onmouseover or a click to make the menu appear, followed by
clicking the (now visible) link for the menu item I want. That was
working in FF7. Now with FF8 the item shows up ever so briefly (on a
click) and then vanishes, or never even shows up at all (as if the
event was never fired)

With FF7 I was able to work with them by using code along these lines

$browser.ul(:id => 'secondary_nav').li(:class => 'has_child_items
selected first').click
$browser.link(:text, 'Create New').click

(the menu bar is a UL (unordered list), and each LI element is one of
the top level menus. The click/mouseover on that item causes the
'pulldown' menu to appear. Thus allowing to click on the menu item
(in the form of a link) that is desired.)

In FF7 that code works just fine, in FF8 the sub-menu is not visible
(or not vis long enough) and generates the element not visible
message.

Is there perhaps some way in watir-webdriver to directly position the
actual mouse cursor over an object in the DOM so that we get a
'genuine' hover response from the browser?

Chuck van der Linden

unread,
Dec 7, 2011, 5:29:33 PM12/7/11
to Watir General
Found I have the same issues in IE9 as well. Older watir worked as
it would let us click the non-visible link, so the script could
navigate regardless of being able to make the menu choice visible.
newer Watir and Watir-webdriver fail because you can't click a link
that is not visible to the user, and I've yet to find a simple way to
make the link visible

Here's a sample CSS based menu of the type I am speaking of
https://www.servage.net/blog/wp-content/uploads/2009/03/css-menu.html
Note that sample is 'very pure-CSS' and won't work on earlier IE
versions. (most 'real' menus of this variety do have some additional
javascript in them to allow the menus to work with earlier IE, but for
many of those, mouseover events seem to work to make the menus dance.
Unfortunately the stuff in my app, while it does work with earlier IE,
still won't dance to the mouseover tune.)

if anyone can find a good way to automate this in Watir or Watir-
Webdriver for IE and FF8 I'd love to see code.

At the moment I'm kludging it by executing a bit of JQuery javascript
(to modify the CSS for the appropriate class+element combination and
change display from none to block so it renders all the menus visible)
and then clicking the link. Something a bit more organic would be
nice.

Jari Bakken

unread,
Dec 7, 2011, 7:08:59 PM12/7/11
to watir-...@googlegroups.com
On Wed, Dec 7, 2011 at 11:29 PM, Chuck van der Linden <sqa...@gmail.com> wrote:

if anyone can find a good way to automate this in Watir or Watir-
Webdriver for IE and FF8  I'd love to see code.


 If you're on a platform that supports WebDriver's native events, you can do this by using the ActionBuilder API from WebDriver:


Native events are currently only supported on Windows and Linux, and is only enabled by default on Windows. The code above shows how to explicitly enable it on Linux.

I should probably add Element#hover to watir-webdriver - feel free to open an issue for that.

Abe Heward

unread,
Dec 23, 2011, 11:09:59 AM12/23/11
to watir-...@googlegroups.com
I am definitely also experiencing a variant of this problem.  The menu I want appears partially obscured in the upper left corner of the browser and the script throws the MoveTargetOutOfBoundsError.


Abe Heward

unread,
Dec 23, 2011, 11:16:32 AM12/23/11
to watir-...@googlegroups.com
Jari, isn't there already an issue open for this?

Abe Heward

unread,
Dec 23, 2011, 1:25:28 PM12/23/11
to watir-...@googlegroups.com
Chuck, thanks for the jQuery hint. That's the solution I've come to, as well.

Chuck van der Linden

unread,
Dec 27, 2011, 1:51:36 PM12/27/11
to Watir General
On Dec 23, 10:25 am, Abe Heward <abe.hew...@gmail.com> wrote:
> Chuck, thanks for the jQuery hint. That's the solution I've come to, as
> well.

Meanwhile it looks like Jarib just added a .hover method to the
element class, and marked https://github.com/jarib/watir-webdriver/issues/46
as closed. a little holiday present for us in the next release.

Thanks Jarib!

Reply all
Reply to author
Forward
0 new messages