开发者

Identifying content displayed inside QTP

开发者 https://www.devze.com 2023-01-24 22:19 出处:网络
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 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 d开发者_如何学JAVAoesn'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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消