目前的場景只是原始應用程序的虛擬。我有一個表格,有2 textboxes
,1 ErrorProvider
和button Validate
。當文本框爲空時,單擊驗證,然後2個錯誤提供程序出現在文本框前分別表示input 1 missing
和input 2 missing
。下面是檢測ErrorProvider的錯誤消息
現在我自動化研究小組正在檢測ErrorProvider控件工具提示的形式。他們正在使用QTP。對這個測試方面知之甚少,我開始了我的分析。我在QTP上試過的是
SwfEdit("textbox1").GetErrorProviderText()
但沒用。我總是得到空文本。
然後我決定用White
框架來實現這個東西。我能夠得到errorProvider控件,但不知道如何獲取每個文本框的錯誤消息。這個代碼我寫到目前爲止
AutomationElement rootElement = AutomationElement.RootElement;
var winCollection = rootElement.FindAll(TreeScope.Children, Condition.TrueCondition);
var automationElement = (from AutomationElement n in winCollection where n.Current.Name == "Error Provider Test" select n).FirstOrDefault();
if (automationElement != null)
{
Condition propCondition = new PropertyCondition(AutomationElement.AutomationIdProperty, "errorProviderInput", PropertyConditionFlags.IgnoreCase);
}
我不知道如何繼續進行,如果我是正確的道路上。我很樂意聽到新的想法,建議或指導來實現這一點。謝謝。