Exiting out of a frame using JavaScript
Hi,
I'm working on web application for GUI automation testing. The application web-page has few iFrames within which there are web-elements defined. For better performance of element identification, I switch to the frame and then search for the web-element. After this is completed, I would like to switch back to the default content (which is not an iFrame) and proceed with element identification and rest of the execution.
How to proceed in this scenario? The Frame method needs an index or name - https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/web-objects/frame-method-web-object.html
But I can't use this to switch back to default content as it is not an iFrame. I have tried the below approaches but no success:
let xpath = "//div[@class=\"topmenu\"]/table/tbody/tr/td[contains(text(),'MainTab')]";
let myTabObj = page.FindChildByXPath(xpath);
return myTabObj;
}
2) Refresh the page after switching to iFrame, to reload the page with entire HTML DOM of the webpage so that the MainTab web element can be found in the DOM.
Please suggest/help. Thanks!
Hi,
Like Marsha wrote...
TestComplete, unlike Selenium, does not switch to iframe and does not need to switch back. It just assesses elements as they are displayed in the Object Browser.
E.g. (pseudocode):
page.frame(1).button('subscribe').Click();
Log.Message(page.Panel('subscriptionCounter').wText);
page.frame(2).button('sendInvite').Click();
...