Track WPF message box text and confirmation box 'Yes' button in Coded UI testing

我的梦境 提交于 2019-12-23 04:48:25

问题


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:

for message box:

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

Thanks for the help!!!


回答1:


Use "record" facility to get all the details:

Record actions

Thanks!



来源:https://stackoverflow.com/questions/39293063/track-wpf-message-box-text-and-confirmation-box-yes-button-in-coded-ui-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!