Jump to content

IE and Frames


 Share

Recommended Posts

I'm getting some strange errors when I try to use frames. I can't share the pages I'm scripting because they're secure intranet, but I'll use an example from another thread - here:

http://www.autoitscript.com/forum/index.ph...ternet+explorer

When I use this code:

#include <IE.au3>
$oIE = _IECreate ("http://verkopen.marktplaats.nl/select_category.php")
$oFrame = _IEFrameGetObjByName($oIE, "body")
$oForm = _IEFormGetObjByName ($oFrame, "postform")
$oSelect = _IEFormElementGetObjByName ($oForm, "l1")
_IEFormElementOptionselect ($oSelect, "565", 1, "byValue")

I get the following error in IE.au3 when AutoIT tries _IEFormGetObjByName in line 3.

Line 1246 (File "C:\Program Files\AutoIT3\Include\IE.au3")

$o_col = $o_object.document.forms.item($s_Name)

$o_col = $o_object.document^ERROR

Error: The requested action with this object has failed.

I believe I'm having a problem with frames because $oFrame.location.href() - with or without the parens() - throws an error, and any property of $oFrame is 0, blank or jibberish/binary.

I'm on Windows XP Pro SP2, using AutoIT v. 3.2.0.1

It just seems that I can't get a frame object to return with any usable properties.

If I'm doing this wrong, and someone could show me the proper way to work through the example linked above, it would be a great help.

Link to comment
Share on other sites

Please place _IEErrorHandlerRegister() after your #include, run it in SciTe and see what kind of COM error is being encountered.

Dale

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

Link to comment
Share on other sites

--> COM Error Encountered in ietest.au3
----> $IEComErrorScriptline = 1246
----> $IEComErrorNumberHex = 80020009
----> $IEComErrorNumber = -2147352567
----> $IEComErrorWinDescription = Access is denied.
----> $IEComErrorDescription = Access is denied.
----> $IEComErrorSource = 
----> $IEComErrorHelpFile = C:\WINDOWS\System32\mshtml.hlp
----> $IEComErrorHelpContext = 0
----> $IEComErrorLastDllError = 0

I get this whenever I try to do something in frames.. any ideas?

Link to comment
Share on other sites

--> COM Error Encountered in ietest.au3
----> $IEComErrorScriptline = 1246
----> $IEComErrorNumberHex = 80020009
----> $IEComErrorNumber = -2147352567
----> $IEComErrorWinDescription = Access is denied.
----> $IEComErrorDescription = Access is denied.
----> $IEComErrorSource = 
----> $IEComErrorHelpFile = C:\WINDOWS\System32\mshtml.hlp
----> $IEComErrorHelpContext = 0
----> $IEComErrorLastDllError = 0

I get this whenever I try to do something in frames.. any ideas?

The "Access is denied." is the key.

Your frame(s) URLs are in a different domain than their parent windows. There is no way around this - it is a security restriction. The only suggestion I have is to open the URL of the frame you want in a seperate browser window and work with it there.

Dale

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

Link to comment
Share on other sites

The "Access is denied." is the key.

Your frame(s) URLs are in a different domain than their parent windows. There is no way around this - it is a security restriction. The only suggestion I have is to open the URL of the frame you want in a seperate browser window and work with it there.

Dale

Really? I'm pretty sure it's all in the same domain. I've managed to use the _IEHeadInsertEventScript function and to write a javascript function which uses document.frames[x].document.getElementById('foo') method to manipulate the frame's dom from the parent document, but that's a big hassle to do it that way, and this will be a function I need regularly.

Can someone show me an example of the normal AutoIT code working on a website somewhere? I'm just trying to eliminate the possibility of something configured incorrectly with my system.

What I really need to do is to make sure certain text shows up on a website after navigating to it. It seems that AutoIT can't read anything in the web browser, and the udf's can't drill in past the frames.

Link to comment
Share on other sites

The helpfile examples for _IEFrame* will give you something to test with. They use _IE_Example ("frameset") that will create a browser window with a valid frameset for you to test with.

Dale

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

Link to comment
Share on other sites

The helpfile examples for _IEFrame* will give you something to test with. They use _IE_Example ("frameset") that will create a browser window with a valid frameset for you to test with.

Dale

Right, but that's all created on the fly. I just want an objective website to compare against. If AutoIT can only read websites that it creates itself, then I vastly overestimated it.

Link to comment
Share on other sites

Right, but that's all created on the fly. I just want an objective website to compare against. If AutoIT can only read websites that it creates itself, then I vastly overestimated it.

:Sigh:. I'd say I've overestimated you at this point until you do more to try to help yourself.

There are frameset websites everywhere on the internet and they are not hard to find. Most of them do not have cross-site url's in the frames. Find one - it will work the same as thes generated in the examples I gave.

Dale

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...