Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identifying content displayed inside QTP

Tags:

qtp

I am trying to identify the content displayed inside a frame using QTP. I am asking from the Page all the frames that match the description and get a collection of frames. I take the first frame from the collection but from some reason it seems that the Object doesn't exist, and therefore I can't reach the content displayed inside. Any idea how Can I extract the content inside the frame, and why doesn't the QTP recognize it as an an existing object? (Remark: I intentionally didn't use the repository to identify the frame cause the frame has unique location in the Page with dynamic indexes to identify its location)

Thanks, Nathan

Code Description:

set TargetPage= Browser(...).Page(...)

Set objDesc = Description.Create()
objDesc("micclass").Value = "Frame"
objDesc("html id").Value = "id"
objDesc("html tag").value = "IFRAME"
objDesc("name").value = "id"

set FramesCollection = TargetPage.ChildObjects(objDesc)

Print FramesCollection .count-> Prints a number >0

set firstFrame=FramesCollection(0)
firstFrame.Exist-> Returns False
like image 393
Nathan Avatar asked Aug 22 '26 02:08

Nathan


1 Answers

You can't use Exist on an object returned by ChildObjects for a full explanation on why this is see this blog post.

You should just use the object without checking whether it exists. If you want to prove to yourself that the object is actually found correctly you can use the undocumented Highlight method.

like image 163
Motti Avatar answered Aug 23 '26 23:08

Motti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!