Question

Present scenario is just a dummy of original application. I have a form with 2 textboxes, 1 ErrorProvider and a button Validate. When textboxes are empty and you click Validate then 2 errorprovider appears in front of textboxes saying input 1 missing and input 2 missing respectively. Below is the form

enter image description here

Now my automation team is trying to detect the errorProvider tooltip. They are using QTP. With minimal knowledge of this testing side I started my analysis. What I tried in QTP is

SwfEdit("textbox1").GetErrorProviderText() but of no use. I am getting empty text always.

I then decided to use White framework to achieve the things. I am able to get the errorProvider control but not sure how to get the error message for each textbox. This the code I wrote till now

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);
}

I am not sure how to proceed further and if I am on right path. I will be happy to hear new ideas, suggestion or guidance to achieve this. Thanks.

Was it helpful?

Solution

I found a solution for the problem in the end.

With my analysis I noticed that QTP is having some problem in reading the controls of .Net framework 4.0 or above.

Suggested Solutions:

  1. Generally QTP fails to detect .Net framework 4.0 version if .Net framework is installed on machine after QTP installation. A clean installation from scratch may help to resolve the issue. Uninstall both QTP and .Net framework and then install .Net framework first and then QTP).

  2. In order to manually resolve the issue, we must register 2 dlls manually. They are Mercury.QTP.Agent.dll and Mercury.QTP.WpfAgent.dll. Follow the below steps to register the dlls.

    • 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

Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top