Micro Focus QTP (UFT) Forums
Surpress (or other) Warning messages - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Surpress (or other) Warning messages (/Thread-Surpress-or-other-Warning-messages)



Surpress (or other) Warning messages - mv8167 - 09-12-2011

I have 8 dialog boxes that Can open depending on a link. There are just to many reports and name changes to track which report will use which dialog box. So, my code looks at each dialog box that opens and determines my the characteritics which dialog box has opened, then runs my code for the test.

My code:
Code:
If blFlagA1="True" AND blFlagA2="True" AND blFlagA3="True" AND blFlagA4="True" Then
  ...
End If

If blFlagB1 = "True" AND blFlagB2 = "True" Then
  ...
End If

If blFlagCA1="True" AND blFlagC2="True" AND blFlagC3="True" Then
  ...
End If
...

But I noticed in my Results, for each object that the Flags are not found, I recive a Warning Message: "The object was not found using the test object description. Check the object's properties". Which is correct as the correct dialog box for these does not exist. Continuing on in the code will find the correct Flag matches, or end in error.

How can I turn off the Warning when/if the first, second ... etc If/Then statement is not encountered?

Any ideas?


RE: Surpress (or other) Warning messages - vIns - 09-13-2011

Hi Lorena...
Please check if the object exists first for each flag. It is a good practice which will avoid some run time errors.

Browser(..).Page(..).Exist(1) -- it return true or false ...based on tht u can build ur logic.




RE: Surpress (or other) Warning messages - Ankesh - 09-13-2011

Hi Lorena,

This error comes usually when smart Identification is turned on. The object was not found in The OR so qtp is searching it using the smart identification (any object with similar description). Thats why u r getting the warning message.

I faced the similar problem once. I deleted the old object from The OR and added the new one. My problem was solved.

U can also try this. I hope this would work for u as well.

Do let me know if it doesn't work.

Regards,
Ankesh




RE: Surpress (or other) Warning messages - mv8167 - 09-13-2011

@vIns, yes, some of the objects are in my OR. But they change names daily, so I need to use DP to execute my code.

@Ankesh, you are correct. I disabled the smart ID. But now my script is failing in others places. Must I relearn my objects?

thx


RE: Surpress (or other) Warning messages - vIns - 09-14-2011

Hi..u can use regular expression in OR to identify the objects for which the name changes...


RE: Surpress (or other) Warning messages - Ankesh - 09-14-2011


Hey dont disable the Smart Identification. Just re-add the object and use it in ur script (just to chk if it works).

Yes @VIns suggestion sounds good to me. U can use regular expression in The OR itself for the objects changing its properties daily.


RE: Surpress (or other) Warning messages - xuyubo.test@163.com - 09-14-2011

perfect, good study


RE: Surpress (or other) Warning messages - mv8167 - 09-14-2011

Im not so good with RegExp, but I will try. I will look into this... Thx! ;-)