This is a migrated thread and some comments may be shown as answers.

Trouble finding Nested IFrame

3 Answers 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 03 Mar 2014, 09:29 PM
I need to write a reusable testing function that will find a nested IFrame and return it as a Browser object to be used later.  The code below never seems to find the nested frame.  frameCount always comes back equal to one (even though there are 2 frames on the page, the parent frame and the nested frame).  Manager.ActiveBrowser.WaitForFrame(leaseCalcFrame) always returns null.  Thoughts on what I could be doing wrong or missing?  Thanks!

            Manager.ActiveBrowser.Frames.WaitAllUntilReady();
            Manager.ActiveBrowser.Frames.RefreshAllDomTrees();
            var framesCount = Manager.ActiveBrowser.Frames.Count;
            var leaseCalcFrame = new FrameInfo { Id = "NestedFrameId", Name = "NestedFrameName" };

            if (Manager.ActiveBrowser.WaitForFrame(leaseCalcFrame) != null)
            {
                var iframe = Manager.ActiveBrowser.Frames[leaseCalcFrame.Id];
                iframe.WaitUntilReady();
                return iframe;
            }

            return null;

3 Answers, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 07 Mar 2014, 09:11 AM
Hi,

The problem in you code is that you have to set the property UseQuery of the FrameInfo object to false. By default is true. Look at the code bellow.

Manager.ActiveBrowser.Frames.WaitAllUntilReady();
            Manager.ActiveBrowser.Frames.RefreshAllDomTrees();
            var framesCount = Manager.ActiveBrowser.Frames.Count;
            var leaseCalcFrame = new FrameInfo { Id = "NestedFrameId", Name = "NestedFrameName", UseQuery=false };
 
            if (Manager.ActiveBrowser.WaitForFrame(leaseCalcFrame) != null)
            {
                var iframe = Manager.ActiveBrowser.Frames[leaseCalcFrame.Id];
                iframe.WaitUntilReady();
                return iframe;
            }
 
            return null;


Regards,
Dobry Zranchev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Erik
Top achievements
Rank 1
answered on 11 Mar 2014, 04:00 PM
Thanks for getting back to me.  I tried the setting the Usequery = false.  Still getting the time out error.  And the framesCount is still equal to 1 in the line before I set up the FrameInfo object.  Any thoughts on why the ActiveBrowser is only finding the top level frame.  There are about 10 or so IFrames nested within that top level frame, but the top level frame is the only one being found.
0
Velin Koychev
Telerik team
answered on 14 Mar 2014, 12:09 PM
Hi Erik,

I am sorry to hear this suggestion didn't help. 

If it is possible, please grant us access to your application so we can reproduce the issue on our end and give you a solution. 
If direct access is not possible, capture a Fiddler trace and attach it to this support ticket in a zip file. If you are unfamiliar with how to do so, this link will provide you with step-by-step instructions for download and use. If taking a Fiddler trace please be sure to:
1. Click Clear Cache first
2. Check Store binaries
3. Check Decrypt HTTPS traffic

Hope to hear from you soon.
 
Regards,
Velin Koychev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Erik
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Erik
Top achievements
Rank 1
Velin Koychev
Telerik team
Share this question
or