surfymark Posted July 13, 2012 Share Posted July 13, 2012 I am getting an error in my script. It doesn't affect the running of the script but it is starting to annoy me! Basically in my Intranet page, I select an option that spawns a Popup box. I then click some options and Submit the form. The Popup reloads with a single "Close" link which I click and close the window. I can then go back to the main IE Window and continue running code on it fine. My code is this: $oIEPopup = _IEAttach("Read meter","DialogBox") Local $oForm = _IEFormGetObjByName($oIEPopup, "formAffichageServiceAMM") _IELinkClickByText($oForm,"Close") The code works fine but the last line causes the error: --> IE.au3 V2.4-0 Error from function _IELoadWait, $_IEStatus_InvalidObjectType (HTMLFormElement) Any ideas why? As I said before, the code continues and everything else runs fine. If I comment the line out, I don't get the error (but of course the popup doesn't then close). cheers Mark Link to comment Share on other sites More sharing options...
MrMitchell Posted July 15, 2012 Share Posted July 15, 2012 According to the Help File the first parameter of _IELinkClickByText() must be an IE Application, Window or Frame object but doesn't say it can be a form object. You might be able to just replace $oForm with $oIEPopup which should be a window if the _IEAttach() function is successful. Link to comment Share on other sites More sharing options...
surfymark Posted July 17, 2012 Author Share Posted July 17, 2012 According to the Help File the first parameter of _IELinkClickByText() must be an IE Application, Window or Frame object but doesn't say it can be a form object. You might be able to just replace $oForm with $oIEPopup which should be a window if the _IEAttach() function is successful.Hi MrMitchell,I did read this in the help file. I am used the IELinkClickByText throughout my code for both IE Windows and Forms and it seems to work fine for both (even in this case it works fine, it just leaves behind the warning message).I tried your suggestion but it didn't work. I got these errors:C:Program Files (x86)AutoIt3IncludeIE.au3 (574) : ==> The requested action with this object has failed.:While Not (String($o_object.document.readyState) = "complete" Or $o_object.document.readyState = 4 Or $f_Abort)While Not (String($o_object.document^ ERRORand the script then just terminated immediately.I will go back to how it was and just live with the warning I think.I also have a line later in my script where I have to check if an IE object exists and if so, click it. Again the only way to do it seems to be to perform the click and then do something if it has an error. So again I get a trailing warning while running my script.I guess as long as it doesn't break the script then it works fine!cheers and thanks for your helpMark Link to comment Share on other sites More sharing options...
MrMitchell Posted July 17, 2012 Share Posted July 17, 2012 Change:_IELinkClickByText($oForm,"Close")to_IELinkClickByText($oForm,"Close", 0, 0)The reason for the final 0 is you're telling IE to not wait for the page to finish loading after click because for this case when you click close it kills the window/form and has nothing to wait for. Hopefully that gets rid of your warning. Link to comment Share on other sites More sharing options...
DaleHohm Posted July 23, 2012 Share Posted July 23, 2012 This conclusion is false. _IELinkClickByText() operates on the full collection of links in a document. You may be fooled into thinking that it works on a form because IE.au3 will first retrieve the document object and use it when a document element is passed as the first parameter. 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...
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