我想使用CodedUI自動化桌面應用程序我正在嘗試點擊按鈕時出現錯誤。請給我一個解決方案。編碼的用戶界面:另一個控件阻止控制
{"Another control is blocking the control. Please make the blocked control visible and retry the action. Additional Details:
TechnologyName: 'MSAA'
ClassName: 'WindowsForms10.BUTTON'
ControlType: 'Window'\r\n"}
代碼:
WinWindow SearchButtonWindow = new WinWindow();
SearchButtonWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
SearchButtonWindow.SearchConfigurations.Add(SearchConfiguration.VisibleOnly);
SearchButtonWindow.SearchProperties[WinWindow.PropertyNames.ControlType] = "Window";
SearchButtonWindow.SearchProperties[WinWindow.PropertyNames.ControlName] = "cmdSearch";
//SearchButtonWindow.WindowTitles.Contains("Ascend Retail Management Software");
WinButton SearchButton = new WinButton();
SearchButton.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
SearchButton.SearchConfigurations.Add(SearchConfiguration.VisibleOnly);
SearchButton.SearchProperties[WinWindow.PropertyNames.ControlType] = "Button";
SearchButton.SearchProperties[WinButton.PropertyNames.ControlName]= "cmdSearch";
Mouse.Click(SearchButton);
有多少其他非常類似的問題在這裏堆棧溢出和其他網站你研究過嗎? – AdrianHHH
我幾乎嘗試過。我沒有找到任何解決方案,他們都是解決方法,如獲取邊界,然後單擊,單擊使用KeyBoard輸入。但與我的應用程序的問題是,CodedUI顯示一個窗口和一個按鈕具有相同的控制名稱和相同的邊界。是否有任何方法,我們可以單擊按鈕使用Mouse.Click? –