我正在尝试自动化 sharepoint 2010 人员选择器,但即使突出显示窗口内的任何控件也非常困难。我使用手动编码来查找窗口,但窗口内的控件没有突出显示。
WinWindow pp = new WinWindow(browserWindow);
pp.TechnologyName = "MSAA";
pp.SearchProperties[WinWindow.PropertyNames.ClassName] = "Internet Explorer_TridentDlgFrame";
pp.SearchProperties[WinWindow.PropertyNames.ControlType] = "Window";
pp.SearchProperties[WinWindow.PropertyNames.Name] = "Select People -- Webpage Dialog";
pp.Find();
pp.DrawHighlight();
Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument doc = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(pp);
doc.TechnologyName = "Web";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.TagName] = "BODY";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.ControlType] = "Document";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Select People";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.PageUrl] = PAGE_URL_Here;
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.AbsolutePath] = AbsolutePath_Here;
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.ClassName] = "HtmlBody";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FriendlyName] = "Select People";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.HasFocus] = "False";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Exists] = "True";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Enabled] = "True";
doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.IsTopParent] = "False";
doc.Find();
doc.DrawHighlight();
上面的代码很容易突出显示人物选择器窗口,并使用此对象查找其中没有找到任何控件。
它显示此错误...
The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'Web'
TagName: 'BODY'
FrameDocument: 'False'
RedirectingPage: 'False'
ControlType: 'Document'
我做对了吗。