UITestControl uiLinkAboutus = new UITestControl(_bw);
uiLinkAboutus.TechnologyName = "Web";
uiLinkAboutus.SearchProperties.Add("ControlType", "Image");
uiLinkAboutus.SearchProperties.Add("TagName", "IMG");
uiLinkAboutus.SearchProperties.Add("Alt", "Open Menu");
Mouse.Click(uiLinkAboutus);
/ *执行时,单击下拉按钮但未单击下面列出的选项。如何解决这个问题呢?
答案 0 :(得分:0)
不使用搜索图像,而是使用wpfCombobox,winCombobox或HtmlComboBox控件搜索列表或下拉控件。在那里,您将selectedItem属性设置为您想要的值。这是在UI中选择项目最强大的方法。所以例如:
ApplicationUnderTest aut = ApplicationUnderTest.Launch(@"yourapp.exe");
WpfComboBox cbBox = new WpfComboBox(aut);
cbBox.SearchProperties.Add(WpfComboBox.PropertyNames.AutomationId,"cmbCountries");//AutomationId == xName roperty
cbBox.SelectedItem = "your value";