MSAA Fails to find winforms controls

喜夏-厌秋 提交于 2019-12-22 20:07:06

问题


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

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