在编码的UI测试中跟踪WPF消息框文本和确认框的“是"按钮 [英] Track WPF message box text and confirmation box 'Yes' button in Coded UI testing

查看:118
本文介绍了在编码的UI测试中跟踪WPF消息框文本和确认框的“是"按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何从WPF消息框而不是Web跟踪消息,以及如何在编程的UI测试"中单击确认消息框的是"按钮?

How can we track the message from the WPF message box instead of web, also how to click 'Yes' button of a confirmation message box in Coded UI Testing programmatically?

我尝试了以下操作,但不起作用:

I tried the following but it's not working:

对于消息框:

    UITestControl msgBox = new UITestControl(App);
    msgBox.TechnologyName = "MSAA";
    msgBox.SearchProperties.Add("ControlType", "Text");
    msgBox.SearchProperties.Add("Name", "Test cases added successfully.");
    bool isExist = msgBox.Exists;
    Assert.IsTrue(isExist);

用于确认对话框的是"按钮:

for confirmation dialogue 'Yes' button:

    UITestControl btnYes = new UITestControl(App);
    btnYes.TechnologyName = "MSAA";
    btnYes.SearchProperties.Add("ControlType", "Button");
    btnYes.SearchProperties.Add("AutomationId", "Yes");
    Mouse.Click(btnYes);

感谢您的帮助!

推荐答案

使用"记录"工具获取所有详细信息:

Use "record" facility to get all the details:

记录操作

谢谢!

这篇关于在编码的UI测试中跟踪WPF消息框文本和确认框的“是"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆