获取Combox内的所有值 [英] Get all the values inside the Combox
本文介绍了获取Combox内的所有值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在尝试检索ComboBox内部的所有值.我用下面的代码
I am trying to retrieve all the values inside the ComboBox. I used below code
UITestControlCollection ui = this.UIMap.UImyWindow.UIItemWindow.UIComboBox.GetChildren();
UITestControlCollection ui = this.UIMap.UImyWindow.UIItemWindow.UIComboBox.GetChildren();
但是它没有给出结果.有人可以帮我吗
But it did not given the results. Could anyone help me on this
推荐答案
嗨Bhargavajulaganti,
Hi Bhargavajulaganti,
我始终使用以下代码来获取项目中的组合框内容,请参考它:
I always use the following code to get the combobox content in my project, please refer to it:
HtmlComboBox comboBox = new HtmlComboBox(window);
comboBox.SearchProperties[HtmlComboBox.PropertyNames.Id] = "yourID";
string[] comboBoxContents = comboBox.GetContent();
foreach (string test in comboBoxContents)
{
Debug.WriteLine(test);
}
此致
奥斯卡
这篇关于获取Combox内的所有值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文