Micro Focus QTP (UFT) Forums
Having issues getting QTP 10 to recognise an IE frame via DP - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Having issues getting QTP 10 to recognise an IE frame via DP (/Thread-Having-issues-getting-QTP-10-to-recognise-an-IE-frame-via-DP)



Having issues getting QTP 10 to recognise an IE frame via DP - Critta - 08-04-2011

Hi there, have been using QTP for some time and am fairly happy that I understand the principles of DP and how QTP references objects using the DOM.

My current issue is related to trying to recognise a frame using DP (I have previously done this using the OR without an issue).

I have written the following object to try and recognise my frame object.

Code:
Set frameObjectDesc = Description.Create
frameObjectDesc("micclass").value = "Frame"
frameObjectDesc("name").value = "header"

My actual code has a select case block to change the name parameter - but I have confirmed that code is working correctly and setting the correct parameter value. I can also confirm that these properties are exactly the same as the ones which the OR is using to correctly identify the frame.

On trying to check the existence of this frame using:

Code:
Browser(browserObjectDesc).Page(pageObjectDesc).Frame(frameObjectDesc).Exist(0)

I am getting a General Run Error reported. The error number being reported for this error is -2147467259 - but all google searches I have tried for this error number seem to be related to database issues which don't seem particularly relevant in this situation.

I have searched all over to try and discover the solution to this issue, but nothing has really shed any light on it. Can anyone here help me out?


RE: Having issues getting QTP 10 to recognise an IE frame via DP - Tarik Sheth - 08-05-2011

Hi,

Could you please add some more information.
A screnshot having the spy on that object would help, also try add some more properties , specially 'index' to identify the object.


RE: Having issues getting QTP 10 to recognise an IE frame via DP - Critta - 08-05-2011

Object spy included - have obfuscated a small amount of url info.

I have tried using all of the properties in various combinations and still get a "General Run Error" whenever I try to run the .exist method on this Frame.

I have confirmed the .exist method on both the browser and page I am using.

Not sure how much use this is going to be for troubleshooting, I really am at the end of what I can think of to try!


RE: Having issues getting QTP 10 to recognise an IE frame via DP - tdevick - 08-05-2011

If this matches more than one object, I can see how that would return a general run error. QTP is not very helpful with errors related to the use of descriptive programming. Try doing this instead:

Code:
Set frameObjectDesc = Description.Create
frameObjectDesc("micclass").value = "Frame"
frameObjectDesc("name").value = "header"
set children=Browser(browserObjectDesc).Page(pageObjectDesc).ChildObjects(frameObjectDesc)
if children.count = 1 then
    <do whatever you would normally do here>
else
    Reporter.ReportEvent micFail, ... (or whatever you want to do here)
end if
set a breakpoint on the line of code after "set children=..." and examine "children.count". My guess is that children.count here is either 0 or > 1. Try that and see if that shows you anything useful.

I'm guessing your code didn't find your frame at all, or it found several matches.


RE: Having issues getting QTP 10 to recognise an IE frame via DP - Critta - 08-08-2011

Hmm, very strange - I've tried as you've suggested and am using the ChildObjects to confirm the number of items available, but every time the set children= line is run, I get the same General Run Error that I do when I try to use the .exist method to confirm the existence of the frame.

Sad

It's almost as if the frame doesn't exist, but I have confirmed using developer tools and object spy, it really does exist!


RE: Having issues getting QTP 10 to recognise an IE frame via DP - tdevick - 08-08-2011

are "browserObjectDesc" and "pageObjectDesc" also created via descriptive programming, or are they just strings?


RE: Having issues getting QTP 10 to recognise an IE frame via DP - Critta - 08-09-2011

Ok, that suggestion pointed me in the right direction - seems this one was me being stupid, rather than anything being wrong with the particular code I showed you.

Seems I'd managed to forget (somehow) to return the page description from the function which created it, thus it was trying to use a nothing description for the page. After reading your last comment I looked back and saw my mistake (I had tested the object found a page which existed within the function it was written in, but hadn't checked it outside)

Thanks for your help in pointing me at my own idiocy Big Grin