THERUNZ Posted July 2, 2012 Posted July 2, 2012 Hello all,I have been working with Autoit for the past few months now and have just started getting into the IE.au3 with manipulating a webpage I work with. I am having problems with the _IELoadWait giving an error at line 585 "WEnd" when waiting for frames on the page to load. I started to create my own script to wait for the page to load as shown below:If IsObj($frame) Then Do $complete = String($frame.document.readyState) $completestat = $frame.document.readystate Sleep(100) Until $complete = "complete" or $completestat = 4ElseIf Not IsObj($frame) Then Do $frame = _IEFrameGetCollection($site, 0) Sleep(100) Until IsObj($frame) Do $complete = String($frame.document.readyState) $completestat = $frame.document.readystate Sleep(100) Until $complete = "complete" or $completestat = 4EndIf With this I get the error: $complete = String($frame.document.readyState^ERROR "The requested action with this object has failed"The webpage pops up with a frame that has me enter information into it while the main page doesn’t change at all. This is why I need to wait for this specific frame to load.I have several of these statements all throughout my script for each page that is loaded. The wait script only fails on frames but has no problem with the site. I have this script looping several times with each bit of information I need to put into the site and it will fail every 4-5th loop giving me this error. I would like it to run indefinitely.The theory I have is that the script is running too fast and while the if statements find it to be an object the full frame is not quite loaded before the script errors out while trying to find the readyState. The network I am on is pretty slow so this may also be an issueI was wondering if anyone could give me some guidance on how to better check the frame load status and wait for it to be fully loaded without having to keep tweaking the sleep timers waiting for the page to load. All help would be much appreciated.
DaleHohm Posted July 3, 2012 Posted July 3, 2012 Your approach here is a reasonable one, simply instantiate a COM error handler to prevent COM errors from being fatal. You can do this on your own, or use _IEErrorHandlerRegister(). You receive the COM error in your code because the document has not loaded yet in your frame when you check the ReadyState. The WEND error in _IELoadWait that you refer to is caused by a synchronization issue in IE.au3 when multiple code paths in IE.au3 try to avoid just the problem you are experiencing here. This will be fixed in a new release. 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
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