Mouse Over issue with Webdriver

4,044 views
Skip to first unread message

Moises Siles

unread,
Aug 11, 2011, 12:23:31 PM8/11/11
to seleniu...@googlegroups.com, webd...@googlegroups.com
Hi guys,

I'm using webdriver with C#, I need to use the mouse over in order to select some options in the menus,

The code that I'm using for the mouse over is the following 

        webElement = FindElement(searchBy);
        new Actions(webDriver).MoveToElement(webElement).Perform();

But is some cases when the MouseOver action is executed the Menu is displayed and immediately the Over action is gone, like if the focus was missing in the menu, and my next action will fail because after the mouse over I'm executing a click selecting the option in the menu displayed by the mouseover

I'm not sure if you guys are facing something similar

Regards

Jim Evans

unread,
Aug 11, 2011, 2:58:41 PM8/11/11
to webdriver
Which browser are you seeing this behaviour with? There are known
issues with IE and hover[1], particularly when the physical mouse
pointer is actually within the borders of the browser window.

--Jim

[1] As near as I can tell, this seems to be an issue with IE itself,
not really something that the Selenium code can work around.

Moises Siles

unread,
Aug 11, 2011, 3:23:43 PM8/11/11
to webd...@googlegroups.com
I saw the same issue in Firefox3.6 and IE8

--
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.


chenyansong

unread,
Aug 11, 2011, 9:47:31 PM8/11/11
to webd...@googlegroups.com
I don't know it help or not,i do it like this and it works:
            do{
                log.info("移动鼠标指针到菜单:" + menu.getText());
                mouseOver(driver, menu);
            }while(!menuBarForm.findElement(By.id(menuId + "_menu")).isDisplayed());

hrabo

unread,
Sep 1, 2011, 6:23:46 AM9/1/11
to webdriver
I also have the same problem with moveToElement.
I use server 2.5, firefox, ie and chrome.

Moises Siles

unread,
Sep 1, 2011, 11:20:24 AM9/1/11
to webd...@googlegroups.com
I have this answer from Jim in one of my questions related to the mouse events........

"I've no idea what version of Firefox the problem manifests in, only
that the method we use to obtain coordinates for mouse operations in
Firefox changed between 2.3 and 2.4. The new method works well in
Linux, but fails on Windows. The nature of the failure doesn't raise
any exceptions or error messages, rather it simply sends mouse
messages to the incorrect location on the screen. Given the nature of
the problem, it is likely it would appear that nothing happens.

--Jim
"

I solved my mouseover issue doing this

                builder.ClickAndHold(webElement).Perform();
                builder.MoveByOffset(5, 5).Perform();

but I'm not sure if this is the best way.

Regards


On Thu, Sep 1, 2011 at 4:23 AM, hrabo <gyorgy.h...@gmail.com> wrote:
I also have the same problem with moveToElement.
I use server 2.5, firefox, ie and chrome.

Ganesh Shrestha

unread,
Oct 3, 2011, 5:48:09 AM10/3/11
to webdriver
I am using the same code snippet as you are using. But this method is
also not suitable to solve the mouse hover issue. Sub menu disappears
before it can click on it from header menu.

Pavithra

unread,
Oct 4, 2011, 6:24:43 AM10/4/11
to webdriver
This might be related to issue: http://code.google.com/p/selenium/issues/detail?id=2067

On Oct 3, 2:48 pm, Ganesh Shrestha <thimigan...@gmail.com> wrote:
> I am using the same code snippet as you are using. But this method is
> also not suitable to solve the mouse hover issue. Sub menu disappears
> before it can click on it from header menu.
>
> On Sep 1, 8:20 pm, Moises Siles <moises.si...@gmail.com> wrote:
>
> > I have this answer from Jim in one of my questions related to the mouse
> > events........
>
> > "I've no idea what version of Firefox the problem manifests in, only
> > that the method we use to obtain coordinates for mouse operations in
> > Firefox changed between 2.3 and 2.4. The new method works well in
> > Linux, but fails on Windows. The nature of the failure doesn't raise
> > any exceptions or error messages, rather it simply sends mouse
> > messages to the incorrect location on the screen. Given the nature of
> > the problem, it is likely it would appear that nothing happens.
>
> > --Jim
> > "
>
> > I solved mymouseoverissue doing this

karthik keyan

unread,
May 30, 2012, 7:20:05 AM5/30/12
to webd...@googlegroups.com, seleniu...@googlegroups.com
Hi Guys,
           Web driver Mouse hover is not working in IE9 when the physical mouse pointer inside browser window?
            Any work around for this guys??
            Environment: Windows7+IE9

Thanks,
Karthik

Moises Siles

unread,
May 30, 2012, 9:33:00 AM5/30/12
to webd...@googlegroups.com
Hi Karthik,

I think that is expected, take a look here


if you are using IE you need to put the mouse pointer outside the window

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/BkDW96y8UOEJ.

Jim Evans

unread,
May 30, 2012, 9:34:14 AM5/30/12
to webd...@googlegroups.com, seleniu...@googlegroups.com
Long-standing known issue with IE. Discussed ad nauseum in this forum (this thread, even[1]), on the issue list[2], and even in presentations at the most recent Selenium Conference[3]. The workaround is to make sure the physical mouse pointer is not located within the bounds of the IE window. This can be accomplished by simple Windows API calls, or by using a library in your language of choice that wraps them[4].

--Jim

[1] https://groups.google.com/d/msg/webdriver/ufjxFkleI0I/GHRd4XvT_REJ
[2] http://code.google.com/p/selenium/issues/detail?id=2067#c21
[3] http://youtu.be/myffo8o67OA
[4] Examples: In Java, the robot classes will do this. In .NET, setting the System.Windows.Forms.Cursor.Position property should work.

karthik keyan

unread,
May 31, 2012, 12:16:07 AM5/31/12
to webd...@googlegroups.com
Thanks a lot guys..
Message has been deleted

StatusQuo

unread,
Jul 18, 2012, 10:55:15 AM7/18/12
to webd...@googlegroups.com, seleniu...@googlegroups.com
Gaurav
I see you are using jQuery for mouse hover . How do you instantiate jQuery for doing so? I tried your script for a page that didn't have jQuery bindings and it didn't work 

Gaurav Kejriwal

unread,
Jul 19, 2012, 12:52:12 AM7/19/12
to webd...@googlegroups.com
First instantiate ur driver.As i am using IE so i used:
IWebDriver driver = new InternetExplorerDriver();
IJavaScriptExecutor jscript = driver as IJavaScriptExecutor;
This is the Code for Webdriver in C# .net.

On Wed, Jul 18, 2012 at 8:25 PM, StatusQuo <mpo...@gmail.com> wrote:
Gaurav
I see you are using jQuery for mouse hover . How do you instantiate jQuery for doing so? I tried your script for a page that didn't have jQuery bindings and it didn't work 

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/A4zFD04pnxQJ.

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.



--

Thanks & Regards

Gaurav Kumar | GDC-RIA |Euronet GDC Pvt. Ltd

T (Desk)  +91-20-3044 7044

Mobile  +91-9970301751

 


Reply all
Reply to author
Forward
0 new messages