如何验证在C#中一个消息框弹出? [英] How to validate a messagebox popup in c#?
本文介绍了如何验证在C#中一个消息框弹出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写了一些测试,并试图验证某些系统消息框的弹出。像 http://www.dotnetperls.com/messagebox-show 。然而,该类消息框是创建消息框。我该如何捕获和验证一个系统生成之一,并在操作?
I was writing some tests and try to validate that some system messagebox is popping up. Like in http://www.dotnetperls.com/messagebox-show. However, the class MessageBox is for creating the messagebox. How shall I capture and validate an system generated one and operate on it?
例如:行动是:
1.click on some execute file.
2.validate a warning messagebox pop up
3.click on yes/no on the messagebox
任何暗示吗?
推荐答案
一种选择是使用白自动化框架。
One choice is to use White automation framework.
例如:
Window messageBox = WindowFactory.Desktop
.DesktopWindows()
.Find(w => w.Title.Contains("MessageBoxTitle"));
Button ok = messageBox.Get<Button>(SearchCriteria.ByText("OK"));
ok.Click();
这篇关于如何验证在C#中一个消息框弹出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文