WPF、白色自动化、拖放悬挂
我目前正在尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请查看此处:http://white.codeplex.com/discussions/271672
此页面展示了一件作品大约:
Check here: http://white.codeplex.com/discussions/271672
This page shows a work around:
没有真正的问题需要回答,但我可以尝试给您一些(有用的?)反馈。
我不了解 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