问题
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