Forum Discussion

TanIlak's avatar
TanIlak
Contributor
2 years ago

How to handle iframe for all the browsers

Hi  How to handle iframes for different browsers and also different web links in TC??? What I need to do exactly is want to hit 1 link in that web link that will open as iframe,fetch some details a...
  • rraghvani's avatar
    2 years ago

    Here's a simple example,

    function iframelink()
    {
        // https://www.w3schools.com/html/tryit.asp?filename=tryhtml_iframe_target    
        var browser = Sys.Browser("chrome");
        var page = browser.Page("https://www.w3schools.com/html/tryit.asp?filename=tryhtml_iframe_target");
        var frame = page.Panel("container").Panel("iframecontainer").Panel("iframe").Panel("iframewrapper").Frame("iframeResult");
        Log.Message(frame.Frame("iframe_a").TextNode(0).contentText);
        frame.Link(0).Click();
        Log.Message(frame.Frame("iframe_a").Panel("main").Panel(0).Panel(0).TextNode(0).contentText);
    }