c# - 如何验证 C# 中的消息框弹出窗口?

标签 c# automated-tests messagebox

我正在编写一些测试并尝试验证是否弹出了一些系统消息框。喜欢http://www.dotnetperls.com/messagebox-show .但是,类 MessageBox 用于创建消息框。我应如何捕获和验证系统生成的系统并对其进行操作?

例如: Action 是:

    1.click on some execute file.
    2.validate a warning messagebox pop up
    3.click on yes/no on the messagebox

有什么提示吗?

最佳答案

一种选择是使用 White自动化框架。

例如:

Window messageBox = WindowFactory.Desktop
                                 .DesktopWindows()
                                 .Find(w => w.Title.Contains("MessageBoxTitle"));
Button ok = messageBox.Get<Button>(SearchCriteria.ByText("OK"));
ok.Click();

关于c# - 如何验证 C# 中的消息框弹出窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23546232/

相关文章:

c# - IsAssignableFrom() 在应该返回 true 时返回 false

eclipse - ReportNG 带有 TestNG 的报告不是使用 WebDriver 生成的

c++ - 如何使用 native C++ 在 WinRT 中创建模式消息框

c# - 如何 string.Join GetHostAddresses 调用的结果?

c# - Automapper & Autofac typeconverter - 没有默认构造函数

c# - 由 ArcGIS 引擎 SDK 提供支持的 .NET 程序报告找不到类型或命名空间 "AxMapControl "

c# - DllImport 放在哪里?

unit-testing - 编写 "unit testable"代码?

selenium - 寻找开源网络测试自动化框架

c - 你好。我正在尝试用 C 语言编写文件索引程序