作爲自動化測試的一部分,我無法單擊SharePoint功能區以選擇「Alert Me」控件。我收到以下錯誤:CODEDUI c#無法單擊SharePoint功能區控件
結果消息: 試驗方法CodedUITestProject2.CodedUITest1.SetAlert拋出異常: Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException:無法在隱藏的控件進行「點擊」。其他細節: TechnologyName: '網頁' ControlType: '超鏈接' 標籤名: 'A' 編號: 'Ribbon.Library.Share.AlertMe.Menu.Scope.AlertLibrary-Menu16' 名稱: '' 目標:「 「 的innerText:'設置在這個圖書館 ---> System.Runtime.InteropServices.COMException警報:從HRESULT異常:0xF004F002
請在下面找到我的代碼:1和2的工作,它的錯誤出在我試着加減了不同的控制設置。
// 1。在功能區
UITestControl CLR = new UITestControl(browser);
CLR.TechnologyName = "Web";
CLR.SearchProperties.Add("InnerText", "LibraryLibrary Tools group. Tab 2 of 2.");
CLR.WaitForControlReady();
Mouse.Click(new Point(CLR.BoundingRectangle.X + CLR.BoundingRectangle.Width/2, CLR.BoundingRectangle.Y + CLR.BoundingRectangle.Height/2));
CLR.WaitForControlReady();
//Mouse.Click(CLR);
Playback.Wait(3000);
//2. set focus on the a pane control on the ribbon
UITestControl FRL = new UITestControl(browser);
FRL.TechnologyName = "Web";
FRL.SearchProperties.Add("TagName", "SPAN");
FRL.SearchProperties.Add("ControlType", "Pane");
FRL.SearchProperties.Add("Class", "ms-cui-groupTitle");
FRL.SearchProperties.Add("InnerText", "Share & Track");
FRL.WaitForControlExist();
FRL.SetFocus();
Mouse.Click(new Point(FRL.BoundingRectangle.X + FRL.BoundingRectangle.Width/2, FRL.BoundingRectangle.Y + FRL.BoundingRectangle.Height/2));
Playback.Wait(3000);
//3. Click on "Alert Me" ID
UITestControl AM = new UITestControl(browser);
AM.TechnologyName = "Web";
//AM.SearchProperties.Add("Inner Text", "Alert Me");
AM.SearchProperties.Add("Id", "Ribbon.Library.Share.AlertMe-Large");
AM.WaitForControlReady();
Mouse.Click(new Point(AM.BoundingRectangle.X + AM.BoundingRectangle.Width/2, AM.BoundingRectangle.Y + AM.BoundingRectangle.Height/2));
Playback.Wait(2000);