Hover() or mouseOver simulation

859 views
Skip to first unread message

D.Mamanakis

unread,
May 6, 2011, 12:47:23 PM5/6/11
to webd...@googlegroups.com
I have looked through several posts and we have the mouseEvents returning:
Unrecognized command: POST /session/47f5b724-b56c-4ccd-8dcf-e876cfbad665/moveto 

hover() has been deprecated. 

What is left?

I need to be able to "move the mouse" to a specific element and hold it there to activate a "hover event"...

I have tried a couple different solutions, but nothing has worked...

Anyone have something working?

Jason

unread,
May 6, 2011, 1:33:32 PM5/6/11
to webd...@googlegroups.com
What browser are you testing against?

Norman Chin

unread,
May 6, 2011, 9:05:43 PM5/6/11
to webd...@googlegroups.com
Read this:
 
 
It works on IE.

On Fri, May 6, 2011 at 10:33 AM, Jason <jml...@gmail.com> wrote:
What browser are you testing against?

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

doridori Jo

unread,
May 6, 2011, 9:59:37 PM5/6/11
to webd...@googlegroups.com
is it possible to get this working in firefoxdriver?

I agree, most javascript based web applications for example on mouseover(hover) the menu item, submenus are expanded....hover() is an absolute must....

I am not sure how to approach that latter situation....A user would hover their mouse cursor over a certain position or certain element, and how would you decide when to fire the hoverhasoccured event?

This is a must have event.....

Robin Lee Powell

unread,
May 7, 2011, 3:15:02 PM5/7/11
to webdriver
How about RemoteDriver? I can't get moveto events working *at all*
over that; I tried a variety of methods, including one based on that
link, in the Ruby Selenium-WebDriver binding, like so:

e=@driver.find_element(:xpath, "//span[text()='IL-4']")
@driver.action.move_to(e, 0, 0).perform;

and from the server I get this:

12:02:41.240 INFO - Executing: [mousemove: 291 false] at URL: /session/
1304794298927/moveto)
12:02:41.254 WARN - Exception thrown
java.lang.UnsupportedOperationException: Unrecognized command: POST /
session/778b8e46-7252-4f63
-a488-8258a557293d/moveto
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:
131)
at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:
105)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
409)
at org.openqa.selenium.remote.RemoteWebDriver
$RemoteMouse.mouseMove(RemoteWebDriver.java:701)
at
org.openqa.selenium.support.events.internal.EventFiringMouse.mouseMove(EventFiringMouse.java:
43)
at
org.openqa.selenium.remote.server.handler.interactions.MouseMoveToLocation.call(MouseMoveToLocation.java:
61)
at
org.openqa.selenium.remote.server.handler.interactions.MouseMoveToLocation.call(MouseMoveToLocation.java:
1)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)
12:02:41.259 WARN - Exception: Unrecognized command: POST /session/
778b8e46-7252
-4f63-a488-8258a557293d/moveto

With no means of triggering the javascript "mouseOver" event, there
are huge amounts of websites that can't actually be tested with
Selenium-WebDriver at all. Especially since the dragElement action,
which does "work", doesn't seem to trigger that event either. With
Selenium 1.0, I'd just use mouse_over and then do the dragging, but I
see no way to do that with Selenium-WebDriver.

I'm more than happy to contribute code to fix this, or help in any
other way I can, but I'd really need some pointers as I've almost no
java experience and certainly none with direct web browser
manipulation.

As it is, though, I'm rather stuck: there's an element of the site I'm
testing that I simply cannot interact with with 2.0b3 (and other
things that don't work in the 1.0 branch; see
http://groups.google.com/group/selenium-users/browse_frm/thread/c0284638f19b503a
if you care).

Thanks for any assistance.

-Robin

On May 6, 6:59 pm, doridori Jo <dorik...@gmail.com> wrote:
> is it possible to get this working in firefoxdriver?
>
> I agree, most javascript based web applications for example on
> mouseover(hover) the menu item, submenus are expanded....hover() is an
> absolute must....
>
> I am not sure how to approach that latter situation....A user would hover
> their mouse cursor over a certain position or certain element, and how would
> you decide when to fire the hoverhasoccured event?
>
> This is a must have event.....
>
>
>
>
>
>
>
> On Fri, May 6, 2011 at 6:05 PM, Norman Chin <norman.c...@gmail.com> wrote:
> > Read this:
>
> >http://groups.google.com/group/webdriver/browse_thread/thread/80b36c5...
>
> > It works on IE.

Robin Lee Powell

unread,
May 7, 2011, 3:32:20 PM5/7/11
to webdriver, norma...@gmail.com
On May 6, 6:05 pm, Norman Chin <norman.c...@gmail.com> wrote:
> Read this:
>
> http://groups.google.com/group/webdriver/browse_thread/thread/80b36c5...
>
> It works on IE.

Can you explain how? Like the original poster, I'm using the
RemoteDriver and the moveto event is simply rejected by 2.0b3.
Assuming you're using the remote driver, can you show us what events
this generates in the server output?

As far as I can tell, the Java bindings work the same way:

// Interactions-related commands.
.put(CLICK, post("/session/:sessionId/click"))
.put(DOUBLE_CLICK, post("/session/:sessionId/doubleclick"))
.put(MOUSE_DOWN, post("/session/:sessionId/buttondown"))
.put(MOUSE_UP, post("/session/:sessionId/buttonup"))
.put(MOVE_TO, post("/session/:sessionId/moveto"))
.put(SEND_MODIFIER_KEY_TO_ACTIVE_ELEMENT, post("/
session/:sessionId/modifier"))

(that's from org/openqa/selenium/remote/HttpCommandExecutor.java ) and
moveto and buttondown give the same "Unrecognized command: POST /
session/778b8e46-7252-4f63-a488-8258a557293d/moveto" sort of error.

So I'm really confused/curious as to how you're making this work.
Help us please!

-Robin

Robin Lee Powell

unread,
May 7, 2011, 4:04:59 PM5/7/11
to webdriver
On May 6, 6:05 pm, Norman Chin <norman.c...@gmail.com> wrote:
> Read this:
>
> http://groups.google.com/group/webdriver/browse_thread/thread/80b36c5...
>
> It works on IE.

(I'm still being moderated, so my apologies if this shows up in the
wrong order.)

Because the server's POST response, which includes an exception from
the server, is what says "Unrecognized command", I and the original
poster assumed it was a problem in the server. Not so, it turns out.
I went source diving, and "Unrecognized command" is a string that
*only* appears in the FireFox javascript web driver (specifically,
trunk/javascript/firefox-driver/extension/components/dispatcher.js
from the svn repo per http://code.google.com/p/selenium/wiki/CheckOut
).

The frustrating part is that it the code *does* seem to implement
moveto, although it does not appear to implement buttondown.... Aaah,
but that's trunk; the code in 2.0b3 for firefox does *not* implement
moveto at all.

So, two questions:

1. Are there nightly builds somewhere or something? Compiling java
is something I'm really badly equipped for.

2. Does anyone know an easy way to *just* change the firefox
javascript, without having to recompile the whole entire server?

Thanks.

-Robin

Robin Lee Powell

unread,
May 7, 2011, 3:34:09 PM5/7/11
to webdriver
On May 6, 10:33 am, Jason <jmle...@gmail.com> wrote:
> What browser are you testing against?

FireFox, but it's all through the selenium-server-standalone-2.0b3.jar
and the remote driver, so I don't know how much it matters? (I mean
that literally: I don't know; maybe a lot).

-Robin

Robin Lee Powell

unread,
May 9, 2011, 3:45:32 PM5/9/11
to webdriver
On May 6, 6:59 pm, doridori Jo <dorik...@gmail.com> wrote:
> is it possible to get this working in firefoxdriver?

If you spend all weekend working on it (20+ hours), yes! :)

Fortunately for you, I've packaged it up. See my next post.

-Robin

D.Mamanakis

unread,
May 9, 2011, 6:16:34 PM5/9/11
to webdriver
I am glad this has generated a discussion, as it seems others are
having the same issues.

I am using FireFox also, and await Robin's solution.

Thanks!

Robin Lee Powell

unread,
May 10, 2011, 12:56:25 AM5/10/11
to webdriver

Eran M.

unread,
May 10, 2011, 6:08:51 AM5/10/11
to webd...@googlegroups.com
Hi,

Support for moveto in the Firefox driver has ben submitted in r12032 and will be included in the next release. I expect to commit support for mouse down/up and click in the next few days - most of it is working, there's one issue with elements outside of the viewport. Once that's solved, it can be committed.

Eran

Reply all
Reply to author
Forward
0 new messages