开发者

WPF, White Automation, drag and drop hanging

I'm currently trying to automate a test case using the White UI-Automation framework.

In doing this I'm having some trouble with drag and drop. I'm trying to drag from a button to a point on the screen, which I calculate based on the location of two other points.

What happens is the button is clicked and the mouse moves to the correct location and then the application hangs until the mouse is manually moved or clicked then the drop occurs and the test continues. If the mouse doesn't receive any manual interaction then the application continues to hang.

The code looks like this:

var criteria = SearchCriteria.ByText(xText);
var yLocation = window.Get(crite);
var yPoint = yLocation.ClickablePoint;
criteria = SearchCriteria.ByText(yText);
var xPoint = window.Get(crite).ClickablePoint;
var dropPoint = new Point(xPoint.X, yPoint.Y);
criteria = SearchCriteria.ByText(buttonName);
var button = (Button) window.Get(criteria);
Mouse.Instance.DragAndDrop(button,开发者_如何学C button.ClickablePoint,yLocation,dropPoint);

Any code after this last line is not executed.

Thanks in advance for any help.


Check here: http://white.codeplex.com/discussions/271672

This page shows a work around:

//Point the mouse for drag

Mouse.Instance.Location = draggedItem.ClickablePoint;

Mouse.LeftDown();

//Move the mouse a little down
Mouse.Instance.Location = new Point(draggedItem.ClickablePoint.X, draggedItem.ClickablePoint.Y + 1);

//Move to the new window
targetWindow.Focus();

//Set the point to drop
Mouse.Instance.Location = targetWindow.ClickablePoint;

//Drop
Mouse.LeftUp();


There is no real question to answer, but I can try to give you some (useful?) feedback.

I do not know about White-UI-Automation framework and I could not find any useful documentation using the link you provided. I suspect DragAndDrop to simply just not return before the drop is complete. This is analogue to how DoDragDrop works in WPF.

If this is the case, I would not say that DragAndDrop is hanging, but rather your app is waiting for the drop to complete before moving on.

//daniel

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜