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;
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;