目前的场景只是原始应用程序的一个虚拟。我有一个带有2个textboxes,1个ErrorProvider和一个button Validate的表单。当文本框为空并单击Validate时,文本框前会出现2个错误提供程序,分别显示input 1 missing和input 2 missing。下面是表格

现在,我的自动化团队正在尝试检测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);
}我不确定如何继续下去,也不确定我是否在正确的道路上。我将很高兴听到实现这一目标的新想法、建议或指导。谢谢。
发布于 2013-07-22 17:07:41
我最终找到了这个问题的解决方案。
通过我的分析,我注意到QTP在读取.Net Framework4.0或更高版本的控件时出现了一些问题。
建议的解决方案:
如果在安装QTP后在机器上安装了.Net framework,则
- Install QTP\_00709 patch if you are using 64 bit OS.
- Open command prompt in Administrator mode.
- Navigate to the location where Mercury.QTP.Agent.dll and Mercury.QTP.WpfAgent.dll are placed.
- Type
..\..\bin\GACRegUtil4x86.exe -i Mercury.QTP.Agent.dll
..\..\bin\GACRegUtil4x86.exe -i Mercury.QTP.WpfAgent.dll
希望能有所帮助。
https://stackoverflow.com/questions/17433049
复制相似问题