Converting Point into ICoordinates for Mouse Move

1,613 views
Skip to first unread message

Aniket Gadre

unread,
Nov 23, 2011, 9:52:07 AM11/23/11
to seleniu...@googlegroups.com

Hi All,
I am trying to use mouse move method of IMouse interface in C#. mousemove method accepts ICoordinates as parameter and element.location returns Point value. How can i convert "Point" object into "ICoordinates" object? I am unable to do typecasting.
--
Best Regards,
Aniket Gadre

Mark Collin

unread,
Nov 23, 2011, 10:30:20 AM11/23/11
to seleniu...@googlegroups.com

In Java Coordinates are a sub class of Point so you can just cast a coordinate into a point.  I assume the structure is the same in C#.

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


-- This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify postm...@ardescosolutions.com

Aniket Gadre

unread,
Nov 23, 2011, 9:34:20 PM11/23/11
to seleniu...@googlegroups.com
It doesn't seem to work in C# :(
Best Regards,
Aniket Gadre
Senior SME - Test Automation
Amdocs , Pune.
E-add: aniket...@amdocs.com

Aniket Gadre

unread,
Nov 24, 2011, 12:56:21 AM11/24/11
to seleniu...@googlegroups.com
Can anyone please help here? I need to move mouse over a particular element. I am not able to get the location in terms of ICoordinate object. I tried type casting Point object into ICoordinate object but no luck.

Mourasman

unread,
Nov 24, 2011, 5:40:13 AM11/24/11
to Selenium Users
Have you tried something like this?

((IMouse)_driver).MouseMove(((ICoordinates)_driver.FindElement(By.XPath("//
a"))), 0, 0);

Mourasman

On 24 Nov, 05:56, Aniket Gadre <aniket....@gmail.com> wrote:
> Can anyone please help here? I need to move mouse over a particular
> element. I am not able to get the location in terms of ICoordinate object.
> I tried type casting Point object into ICoordinate object but no luck.
>
>
>
>
>
>
>
>
>
> On Thu, Nov 24, 2011 at 8:04 AM, Aniket Gadre <aniket....@gmail.com> wrote:
> > It doesn't seem to work in C# :(
>

> > On Wed, Nov 23, 2011 at 9:00 PM, Mark Collin <m...@ardescosolutions.com>wrote:
>
> >> In Java Coordinates are a sub class of Point so you can just cast a

> >> coordinate into a point.  I assume the structure is the same in C#.****
>
> >> ** **
>
> >> *From:* seleniu...@googlegroups.com [mailto:
> >> seleniu...@googlegroups.com] *On Behalf Of *Aniket Gadre
> >> *Sent:* 23 November 2011 14:52
> >> *To:* seleniu...@googlegroups.com
> >> *Subject:* [selenium-users] Converting Point into ICoordinates for Mouse
> >> Move****
>
> >> ** **
>
> >> ****
>
> >> Hi All,****


>
> >> I am trying to use mouse move method of IMouse interface in C#. mousemove
> >> method accepts ICoordinates as parameter and element.location returns Point
> >> value. How can i convert "Point" object into "ICoordinates" object? I am

> >> unable to do typecasting.****
>
> >> --
> >> Best Regards,
> >> Aniket Gadre****


>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Selenium Users" group.
> >> To post to this group, send email to seleniu...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> selenium-user...@googlegroups.com.
> >> For more options, visit this group at

> >>http://groups.google.com/group/selenium-users?hl=en.****


>
> >> -- This message contains confidential information and is intended only
> >> for the individual named. If you are not the named addressee you should not
> >> disseminate, distribute or copy this e-mail. Please notify the sender
> >> immediately by e-mail if you have received this e-mail by mistake and
> >> delete this e-mail from your system. If you are not the intended recipient
> >> you are notified that disclosing, copying, distributing or taking any
> >> action in reliance on the contents of this information is strictly
> >> prohibited. If you have received this email in error please notify

> >> postmas...@ardescosolutions.com


>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Selenium Users" group.
> >> To post to this group, send email to seleniu...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> selenium-user...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/selenium-users?hl=en.
>
> > --
> > Best Regards,
> > Aniket Gadre
> > Senior SME - Test Automation
> > Amdocs , Pune.

> > E-add: aniket.ga...@amdocs.com


>
> --
> Best Regards,
> Aniket Gadre
> Senior SME - Test Automation
> Amdocs , Pune.

> E-add: aniket.ga...@amdocs.com

Aniket Gadre

unread,
Nov 24, 2011, 7:38:14 AM11/24/11
to seleniu...@googlegroups.com
No.. I used Actions class and IAction interface to move mouse. I didn't need to use ICoordinates for it :)
E-add: aniket...@amdocs.com

Mourasman

unread,
Nov 24, 2011, 11:53:00 AM11/24/11
to Selenium Users
So you solved your problem, then? :)

Mourasman

> E-add: aniket.ga...@amdocs.com

Jim Evans

unread,
Nov 24, 2011, 11:57:23 AM11/24/11
to Selenium Users
Using Actions is the right approach for what you are trying to
accomplish. You shouldn't need to use the IMouse object directly. You
haven't mentioned what happens when you try the Actions class, only
that "it doesn't work". Also, it's going to be useful to know what.
Browser you're using, as there are a number of quirks with mouse
movement depending on the browser you're using.

--Jim

> E-add: aniket.ga...@amdocs.com

Aniket Gadre

unread,
Nov 25, 2011, 2:00:45 AM11/25/11
to seleniu...@googlegroups.com
I was able to do mouse move successfully using Actions Class & IAction interface. I used the same class & interface for Drag & Drop operation and its working perfectly!!
E-add: aniket...@amdocs.com

aarti dsouza

unread,
Mar 7, 2014, 11:11:22 AM3/7/14
to seleniu...@googlegroups.com
hi ankit,
 I am trying to move an element..i tried draganddrop it does not work..
 
i also tried mousedown, mousemove and mouseup events...I am using IE8 on Windowns 7. Please let me know..
or show mw sample code i am usign C#
 
DragAndDropCode
 

element = webDriver.FindElement(By.XPath("VALUE"));

 IWebElement Toelement = webDriver.FindElement(By.XPath("VALUE"));

 OpenQA.Selenium.Interactions.IAction dragAndDrop = builder.ClickAndHold(element).MoveToElement(Toelement).Release().Build();

dragAndDrop.Perform

 

 

Reply all
Reply to author
Forward
0 new messages