问题
I am using Coded UI to automate an application. In the automation process a complex process happens inside the application (loading a PowerPoint inside the application). After this process I can't continue the test because MSAA unable to find any controls in the application.I am using Inspect.exe, before and after the automation fails. I have attached the screen shot of Inspect tool before and after the failure. Is there any solution to overcome this issue? I can't continue automation testing without restarting the application whenever I face this problem. Any help would be greatly appreciated !
回答1:
Coded UI supports WinForms and WinControls. I'll suggest you to find the WinWindow by using the code below:
`WinWindow samplewindow = new WinWindow();
samplewindow.SearchProperties[WinWindow.PropertyNames.Name] = "XXYYZZZ";
samplewindow.SearchProperties[WinWindow.PropertyNames.ClassName] = "XXYYYZZZ";
WinButton uIButton = new WinButton(samplewindow);
uIButton.SearchProperties[WinButton.PropertyNames.Name] = "XXYYYZZZ";
Mouse.Click(uIButton, MouseButtons.Left, System.Windows.Input.ModifierKeys.None, uIButton.GetClickablePoint());'
来源:https://stackoverflow.com/questions/22499252/msaa-fails-to-find-winforms-controls