selenium2: mouse moves, hovers, etc

102 views
Skip to first unread message

ponto

unread,
Feb 23, 2010, 11:15:22 AM2/23/10
to Selenium Developers
i was trying selenium2, and the execution of
"driver.find_element(:class, 'cardItemRegister').click" fails with the
following message "Selenium::WebDriver::Error::WebDriverError: Element
is not currently visible and so may not be clicked", so i tried many
things to make a mouse hover the element (that's when he is visible)
such as "driver.find_element(:class, 'cardItemRegister').hover" which
returns me "Selenium::WebDriver::Error::WebDriverError: Internal
error: {"lineNumber":332,"message":"Component returned failure code:
0x80004001 (NS_ERROR_NOT_IMPLEMENTED)
[nsINativeEvents.mouseMove]","name":"NS_ERROR_NOT_IMPLEMENTED"}".

is there anyway to make a mouse move hover the element or so?

i talked on freenode, and it was said to me the hover functions only
worked on firefox running over windows. and i've tried this, but not
always work.
so i've tried "driver.find_elements(:xpath, "//
div[@class='cardThumb']")[0].hover" before the click action, but
sometimes works, depends on how much the elements stay hovered.

Patrick Lightbody

unread,
Mar 6, 2010, 4:35:17 PM3/6/10
to selenium-developers
Yeah, it may just not be supported yet. Have you tried just sending
down a JavaScript call that fires the hover event?

Patrick

--
We provide FREE website monitoring and load testing
http://browsermob.com

Patrick Lightbody
Founder, BrowserMob
+1 (503) 828-9003 x 101

2010/2/23 ponto <hugoand...@gmail.com>:

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

Jonathan Morris

unread,
Mar 9, 2010, 9:53:16 AM3/9/10
to selenium-...@googlegroups.com
If you don't mind, what would that JS look like? I'm in the same quandary with trying to hover to get something visible for WebDriver to see. Thanks.

Patrick Lightbody

unread,
Mar 9, 2010, 10:23:57 AM3/9/10
to selenium-developers
WebDriver doesn't natively support firing random events like that, but
you can do this (which is also what we do for Selenium 1.x
compatibility):

JavascriptLibrary js = new JavascriptLibrary();
WebElement element = driver.findBy(...);
js.callEmbeddedSelenium(driver, "doFireEvent", element, "hover");

Let me know how that works for you.

Patrick

--
We provide FREE website monitoring and load testing
http://browsermob.com

Patrick Lightbody
Founder, BrowserMob
+1 (503) 828-9003 x 101

Jonathan Morris

unread,
Mar 10, 2010, 8:51:30 PM3/10/10
to selenium-...@googlegroups.com, Jonathan Morris
Got a "could not find embedded selenium" error. Traceback when I get a chance.

cburroughs

unread,
Mar 31, 2010, 2:01:47 PM3/31/10
to Selenium Developers
I can suppl the stack trace:
java.lang.RuntimeException: Cannot locate the embedded selenium
instance
at
org.openqa.selenium.internal.seleniumemulation.JavascriptLibrary.readScript(JavascriptLibrary.java:
74)
at
org.openqa.selenium.internal.seleniumemulation.JavascriptLibrary.callEmbeddedSelenium(JavascriptLibrary.java:
40)

and for reference the throwing line is:
InputStream raw = getClass().getResourceAsStream(script);

> >>> 2010/2/23 ponto <hugoandrego...@gmail.com>:


> >>>> i was trying selenium2, and the execution of
> >>>> "driver.find_element(:class, 'cardItemRegister').click" fails with the
> >>>> following message "Selenium::WebDriver::Error::WebDriverError: Element
> >>>> is not currently visible and so may not be clicked", so i tried many
> >>>> things to make a mouse hover the element (that's when he is visible)
> >>>> such as "driver.find_element(:class, 'cardItemRegister').hover" which
> >>>> returns me "Selenium::WebDriver::Error::WebDriverError: Internal
> >>>> error: {"lineNumber":332,"message":"Component returned failure code:
> >>>> 0x80004001 (NS_ERROR_NOT_IMPLEMENTED)
> >>>> [nsINativeEvents.mouseMove]","name":"NS_ERROR_NOT_IMPLEMENTED"}".
>
> >>>> is there anyway to make a mouse move hover the element or so?
>
> >>>> i talked on freenode, and it was said to me the hover functions only
> >>>> worked on firefox running over windows. and i've tried this, but not
> >>>> always work.
> >>>> so i've tried "driver.find_elements(:xpath, "//
> >>>> div[@class='cardThumb']")[0].hover" before the click action, but
> >>>> sometimes works, depends on how much the elements stay hovered.
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
> >>>> To post to this group, send email to selenium-...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to selenium-develo...@googlegroups.com.

> >>>> For more options, visit this group athttp://groups.google.com/group/selenium-developers?hl=en.


>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
> >>> To post to this group, send email to selenium-...@googlegroups.com.
> >>> To unsubscribe from this group, send email to selenium-develo...@googlegroups.com.

> >>> For more options, visit this group athttp://groups.google.com/group/selenium-developers?hl=en.


>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
> >> To post to this group, send email to selenium-...@googlegroups.com.
> >> To unsubscribe from this group, send email to selenium-develo...@googlegroups.com.

> >> For more options, visit this group athttp://groups.google.com/group/selenium-developers?hl=en.

cburroughs

unread,
Apr 5, 2010, 11:16:01 AM4/5/10
to Selenium Developers
I suspect Jonoathan and I are both suffering from
http://code.google.com/p/selenium/issues/detail?id=449

Jonathan Morris

unread,
Apr 6, 2010, 3:34:51 PM4/6/10
to selenium-...@googlegroups.com
That sounds about right. Could we just add that to the JAR ourselves to address? Or should we wait for 2.0a3 (which is scheduled for when, by the way :) ?)

Thanks, Chris.

--jonm

Simon Stewart

unread,
Apr 10, 2010, 8:32:34 AM4/10/10
to selenium-...@googlegroups.com
I keep on saying "soon", and I mean it. I'm doing quite a lot of
traveling, but I'll set aside some quiet time and cut 2.0a3 some time
next week.

Simon

cburroughs

unread,
Apr 12, 2010, 1:54:17 PM4/12/10
to Selenium Developers
I found a prior report of the issue (#412) that includes a patch that
works for me. Note that you will likely need to see #461 to actually
create working artifacts from maven.

(While we are on the subject of releases, it would be super cool if
these patches were included before the next one. Otherwise any one
who wants to use the maven artifacts will have to redo the release
themselves .)

Reply all
Reply to author
Forward
0 new messages