Search code examples
iframeembedimacros

iMacros - Open an iFrame in another tab


How could I open an iFrame in a new tab? I tried using URLCURRENT after selecting the iFrame with "FRAME F = 1" but it did not work.

I think this could be done by using "SEARCH" to search the iFrame code and extract the URL, but I do not know how to do it.


iMacros Firefox (Version 8.9.7)


Solution

  • Here you go...

      'Clear Extraction memory
    SET !EXTRACT NULL
      'Using current tab/window
    TAB T=1 
      'Extract URL from first IFrame
    TAG POS=1 TYPE=IFRAME ATTR=* EXTRACT=HREF  
      'Pass URL to variable
    SET iFrameURL {{!EXTRACT}} 
      'Open new Tab/window
    TAB OPEN
      'Switch to the new Tab/window 
    TAB T=2 
      'Navigate to URL from varable (iframe url)
    URL GOTO={{iFrameURL}}
    

    Modify the POS=1 to the appropriate iframe location if there are multiple iframe... so POS=3 for the 3rd iFrame.

    Please mark this as an answer if this solution helped you. Thanks!