Drag Adapter Problem : Automation API

Drag Adapter Problem

Class library usage, coding and language questions.

Drag Adapter Problem

Postby robbell » Mon Mar 21, 2011 1:40 pm

Hi,

I'm trying to drag an adapter item to another in a WPF app using the Mouse.MoveTo, ButtonDown and ButtonUp methods but I'm experiencing some odd behaviour. In the code below the initial MoveTo operates correctly and I can see from breakpoints being hit that the following ButtonDown is being called, but the following MoveTo isn't being called.

Code: Select all
Mouse.MoveTo(source);
Mouse.ButtonDown(MouseButtons.Left);
Mouse.MoveTo(destination, location);
Mouse.ButtonUp(MouseButtons.Left);


When the test is running, if I wiggle the mouse a bit manually once the ButtonDown has been called, then the second MoveTo executes. Also if I comment out the ButtonDown, the two MoveTos are both executed correctly.

Any suggestions as to why it's not working? I've had a look at some similar posts but with no luck. The element repository contains the parent to the source and destination controls and I've tried setting the "Use Ensure Visible" to false.

Thanks,

Rob
robbell
 
Posts: 1
Joined: Mon Mar 21, 2011 1:19 pm

Re: Drag Adapter Problem

Postby Support Team » Mon Mar 21, 2011 3:41 pm

Hi,

Would it be possible to send us a sample application to reproduce the problem, because I tried an example and it is working as expected. I used your posted code for this example and it works.

Thanks in advance.

Regards,
Peter
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4840
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Drag Adapter Problem

Postby Munro89 » Fri Mar 25, 2011 4:22 pm

I had the same problem here.

I noticed that doing a Mouse.Click before calling the Mouse.ButtonDown makes it work, but sometime it was too fast for our application. Adding a delay (even 10ms) between the Click and ButtonDown made it fail everytime, just as if we used MoveTo and ButtonDown.

I solved it by adding a delay of 25ms between the Mouse.MouseDown and Mouse.MoveTo (to our new Adapter). Now it seem to always work.
Munro89
 
Posts: 17
Joined: Thu Feb 18, 2010 11:06 pm

Re: Drag Adapter Problem

Postby artur_gadomski » Mon Mar 28, 2011 9:05 am

What's your default mouse move speed? I remember ciege writing somewhere that he needs to have a speed greater than 0 for dragging operations.
User avatar
artur_gadomski
 
Posts: 125
Joined: Mon Jul 19, 2010 7:55 am
Location: Copenhagen, Denmark


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests