WPF、白色自动化、拖放悬挂

发布于 2024-11-04 15:30:53 字数 760 浏览 5 评论 0原文

我目前正在尝试使用 White UI 自动化框架 自动化测试用例。
在执行此操作时,我在拖放方面遇到了一些麻烦。我试图从一个按钮拖动到屏幕上的一个点,这是我根据其他两个点的位置计算的。

发生的情况是单击按钮,鼠标移动到正确的位置,然后应用程序挂起,直到手动移动或单击鼠标,然后发生放下并继续测试。如果鼠标没有收到任何手动交互,则应用程序将继续挂起。

代码如下所示:

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, button.ClickablePoint,yLocation,dropPoint);

最后一行之后的任何代码都不会执行。

预先感谢您的任何帮助。

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, button.ClickablePoint,yLocation,dropPoint);

Any code after this last line is not executed.

Thanks in advance for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

可是我不能没有你 2024-11-11 15:30:53

请查看此处:http://white.codeplex.com/discussions/271672

此页面展示了一件作品大约:

//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();

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();
浸婚纱 2024-11-11 15:30:53

没有真正的问题需要回答,但我可以尝试给您一些(有用的?)反馈。

我不了解 White-UI-Automation 框架,并且使用您提供的链接找不到任何有用的文档。我怀疑 DragAndDrop 在放置完成之前根本不会返回。这类似于 WPF 中 DoDragDrop 的工作方式。

如果是这种情况,我不会说 DragAndDrop 挂起,而是您的应用程序正在等待放置完成然后再继续。

//丹尼尔

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文