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 and again need to go back and same process want to do for all links(eg:3) and browser (like chrome and edge).

 

 

  • 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);
    }
  • rraghvani's avatar
    rraghvani
    Champion Level 3

    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);
    }
    • TanIlak's avatar
      TanIlak
      Contributor

      Thanks this is executed but I have doubt here panel is div or any attribute (like html, form, article)

      How do I select in DOM littlebit confused Can you plz clarify this for me