Jump to content
Sign in to follow this  

IFrame problem

Recommended Posts


Hello, fellow AutoIters!

I'm trying to access a site with AutoIt but I'm facing a very strange problem with an IFrame element. The site has only 1 IFrame element and most of the content is in it. The element doesn't have id or name, only src. First it was really hard to access the IFrame itself. The snipped from the help

$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
If $iNumFrames > 0 Then
    If _IEIsFrameSet ($oIE) Then
        MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " frames in a FrameSet")
        MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " iFrames")
    MsgBox(0, "Frame Info", "Page contains no frames")

says that there is one IFrame object, but when I try to get by

$frame = _IEFrameGetCollection($oIE, 0) 
MsgBox(0, "src", $frame.src)

I get an error on $frame.src "The requested action with this object has failed"

All tries with _IEFrameGetCollection have failed.

I finally found a way to access the frame - $frames=_IETagNameGetCollection($ie, "iframe")

After that I do For $frame in $frames

but from this point I cannot access any other element in the frame. With _IEGetObjById I get $_IEStatus_NoMatch. _IETagNameAllGetCollection says there are 0 elements. I even tried _IEFormElementRadioSelect($frame, "1", "option_id") to click on some radio button on the site but I get $_IEStatus_InvalidObjectType

Any ideas how to solve this problem?

Thank you in advance

I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Share this post

Link to post
Share on other sites


Please post the HTML for the website you are trying to access.

Share this post

Link to post
Share on other sites

You are most certainly having a cross-domain scripting problem. If you use _IEErrorHandlerRegister() you'll see "Access Is Denied" errors. You can access the iFrame as a tag, but not as a document container (window) as a result.

The typical way of dealing with this is to open the iFrame URL in a new browser window (you can get the url with $oFrame.src once you have $oFrame as a reference to the iFrame tag).


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this