Alamoosook Posted December 21, 2012 Share Posted December 21, 2012 Please help with the following problem.I have written this following script to retrieve data kept in an iFrame (DATA_IFRAME) which is inside a frame (MAIN_FRAME) on page "Data_Page".#include <IE.au3> Local $o_ie = _IEAttach("Data Page") Local $o_frame = _IEFrameGetObjByName($o_ie, "MAIN_FRAME") Local $o_iframe = _IEFrameGetObjByName($o_frame, "DATA_IFRAME") $text = _IEBodyReadHTML($o_iframe) ConsoleWrite($text & @CRLF)The script which I stripped of all error checking and diagnostics works as it should, but only on my development system running Windows 7 and IE9. It does not work on my production server which runs Windows 2003 and IE8. It also fails if I switch my IE9 into 'compatibility view'.The script fails on this line:Local $o_iframe = _IEFrameGetObjByName($o_frame, "DATA_IFRAME")and produces the following messages:C:\Program Files (x86)\AutoIt3\Include\IE.au3 (813) : ==> The requested action with this object has failed.:If $oFrame.name = $s_Name Then Return SetError($_IEStatus_Success, 0, $oTemp.frames($s_Name))If $oFrame.name = $s_Name Then Return SetError($_IEStatus_Success, 0, $oTemp.frames($s_Name)^ ERRORExamining the HTML as returned from MAIN_FRAME I noticed that if I run IE9 the name value inside the <iframe> tag is in quotes (name="DATA_IFRAME") while under IE8 or IE9cv it is not (name=DATA_IFRAME).I tried to upgrade IE on the server but IE9 for Windows Server 2003 it is not offered.Any thoughts?Thanks in advance. Link to comment Share on other sites More sharing options...
ileandros Posted December 22, 2012 Share Posted December 22, 2012 Check a return on Local $o_iframe = _IEFrameGetObjByName($o_frame, "DATA_IFRAME") on windows 2003 and ie9cv to see what u take.Then if u manage it put an OS check on the top of your script to change the value of $o_iframe depending on the OS ur using it. I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
Alamoosook Posted December 22, 2012 Author Share Posted December 22, 2012 Local $o_iframe = _IEFrameGetObjByName($o_frame, "DATA_IFRAME") does not return anything on IE8 and IE9cv. It crashes inside IE.au3 on line 813. See the error message in my original post. Thanks for looking into this. Link to comment Share on other sites More sharing options...
DaleHohm Posted December 23, 2012 Share Posted December 23, 2012 Add _IEErrorHandlerRegister() before the failure to get more setail on the COM error. I suspect you'll see "Access Is Denied", which indicated a cross-domain security issue. 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 More sharing options...
Alamoosook Posted December 26, 2012 Author Share Posted December 26, 2012 I have added _IEErrorHandlerRegister() as recommended. This is what I got:--> COM Error Encountered in test.au3----> $IEComErrorScriptline = 813----> $IEComErrorNumberHex = 80020009----> $IEComErrorNumber = -2147352567----> $IEComErrorWinDescription =----> $IEComErrorDescription =----> $IEComErrorSource =----> $IEComErrorHelpFile =----> $IEComErrorHelpContext = 0----> $IEComErrorLastDllError = 0--> IE.au3 V2.4-0 Error from function _IEBodyReadHTML, $_IEStatus_InvalidDataTypeWhen you say that you suspect "Access is Denied" is a problem, do you mean a case where the iFrame data is actually pulled from a different web site than the main page? I do not think this is the case. For this test I actually get the page manually using IE, then when it is already on my desktop I run the script. When the script works (with IE9) it works even if I unplug my network cable! I hope this sheds some light. Thanks for looking into it. Link to comment Share on other sites More sharing options...
DaleHohm Posted December 26, 2012 Share Posted December 26, 2012 With the error handler registered, this error should no longer be fatal to your script. See if you can do more testing, like insuring there are no frames or pages being (re)loaded when you make the initial call, try again after a couple of seconds, etc., try using _IEDocReadHTML to examining page and frame source... 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 More sharing options...
Alamoosook Posted December 27, 2012 Author Share Posted December 27, 2012 Dale, Thanks for your help. I did everything you have told me. Actually in the actual code I do check all return codes and I examine the HTML of each page/frame I am going through. I do not go further if the iFrame tag is not in the HTML. As I mentioned the only difference in the MAIN frame HTML, just before I issue the _IEFrameGetObjByName($o_frame, "DATA_IFRAME") call is that if I run IE9 the name value inside the <iframe> tag is in quotes (name="DATA_IFRAME") while under IE8 or IE9cv it is not (name=DATA_IFRAME). For now I will use a workaround. Since the data in the frame is displaying in the browser, I just click over the window and then issue ctrl-a, ctrl-c, and I get the data from clipboard. Kind of crude, but works. I am planning to revisit this later. Thanks for your support. Richard Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now