I have the code below and it does drag and drop from a position to another position but it't not exactly the correct position. How can I slow it down or see what it's doing? I have used Mouse.Move in CodedUI and Mouse.StartDragging etc and you can set the speed and see what they're doing and correct them if required. It's for dragging something on a canvas to another item on a canvas so it is related to position.
I know I'll get there at some point and PMeter is a great tool to use to help you here but I'd like to be able to see what I'm doing sometimes to debug.
Actions builder = new Actions(session);
builder.MoveByOffset(100, -85);
builder.ClickAndHold();
builder.MoveByOffset(gridPos2.X - gridPos1.X, gridPos2.Y - gridPos1.Y);
builder.Release();
builder.Perform();
I created a method for showing the cursor flashing in a colour of your choice...
/// <summary>
/// This method is useful for seeing what the cursor is doing. **Call it like this...**
/// CommonMethods.HighlightCursor(new System.Drawing.Pen(System.Drawing.Color.Red));
/// </summary>
/// <param name="colour"></param>
public static void HighlightCursor(Pen colour)
{
for (int i = 0; i < 10; i++)
{
Point pt = Cursor.Position; // Get the mouse cursor in screen coordinates
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
g.DrawEllipse(colour, pt.X - 5, pt.Y - 5, 10+i, 10+i);
}
Thread.Sleep(150);
}
}