syberschmo Posted September 8, 2006 Share Posted September 8, 2006 Hi I need to submit a form on a webpage using _IE.au3. I tried _IEFormSubmit, but it halted the script after submitting the form. The documentation suggests _IEAction. Here is the relevant portion of the site: <form action="ISAPI.dll" method="post"> <input type="hidden" name="MfcISAPICommand" value=""> <input type="hidden" name="item" value=""> <input type="hidden" name="Username" value=""> <input type="radio" name="isBRT" value="0"> <input type="radio" name="isBRT" value="1" checked> <input type="submit" value="Continue >"> </form> Here is the relevant autoit code: $oForm = _IEFormGetCollection($oIE, 2) _IEFormElementRadioSelect($oForm, "0", "isBRT") $oBtn = _IEFormElementGetCollection($oForm, 5) _IEAction($oBtn, "click") _IELoadWait($oIE) And here is the error: --> COM Error Encountered in Action.au3 ----> $IEComErrorScriptline = 1316 ----> $IEComErrorNumberHex = 80020003 ----> $IEComErrorNumber = -2147352573 ----> $IEComErrorWinDescription = Member not found. ----> $IEComErrorDescription = ----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = ----> $IEComErrorLastDllError = 0 --> IE.au3 Error from function _IEAction, $_IEStatus_InvalidDataType I know my form object is correct, because the correct radio button is selected on the page. I've searched the forum and re-read the helpfile on this, but I can't seem to fix it, even though another part of my script uses _IEAction to submit a different form and it works. Thanks in advance for your help Gradient-Filled Progress Bars UDF Link to comment Share on other sites More sharing options...
DaleHohm Posted September 8, 2006 Share Posted September 8, 2006 Please check the number of form elements after you call _IEFormElementGetCollection with ConsoleWrite("Num Elements: " & @extended) My first guess is that you are trying to reference buyone the end of the element collection. Remember that the 5th element has an index of 4. 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...
syberschmo Posted September 8, 2006 Author Share Posted September 8, 2006 Ok, I changed the code to $oForm = _IEFormGetCollection($oIE, 2) _IEFormElementRadioSelect($oForm, "0", "isBRT") $oBtn = _IEFormElementGetCollection($oForm) ConsoleWrite("Num Elements: " & @extended) ;_IEAction($oBtn, "click") ;_IELoadWait($oIE) And console write returns: Num Elements: 6 But when I use $oBtn = _IEFormElementGetCollection($oForm, 5)with the same code, Autoit crashes with error: --> COM Error Encountered in Action.au3 ----> $IEComErrorScriptline = 1316 ----> $IEComErrorNumberHex = 80020003 ----> $IEComErrorNumber = -2147352573 ----> $IEComErrorWinDescription = Member not found. ----> $IEComErrorDescription = ----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = ----> $IEComErrorLastDllError = 0 I understand that IE.au3 uses a zero-based index, and specifying '5' as an index when there are six items should work, right? Thanks in advance, again. Gradient-Filled Progress Bars UDF Link to comment Share on other sites More sharing options...
DaleHohm Posted September 8, 2006 Share Posted September 8, 2006 (edited) It is acting like something funky is happening to the $oForm object after the _IEFormElementRadioSelect call... perhaps change the function call to tell it not to fire the onchange event and see if it fixes it. Otherwise, see if you can post a full reproducer so that I can take a look. Dale Edit: remove quoted text Edited September 8, 2006 by DaleHohm 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...
syberschmo Posted September 11, 2006 Author Share Posted September 11, 2006 I played with the radio select stuff but the error still occurs even with it removed. Here is a full reproducer, as requested: #include <IE.au3> _IEErrorHandlerRegister() ;WRITE DOCUMENT $oIE = _IECreate() $shtml = "<html><head><title>asd</title></head><body><form action=""http://www.google.com/"" method=""post"">" $shtml &= "<input type=""hidden"" name=""ISAPICommand"" value=""ItemsBySellerSearch""><input type=""hidden"" name=""item"" value=""0000"">" $shtml &= "<input type=""hidden"" name=""Username"" value=""test""><b>Report:</b><br><table border=""0"" cellspacing=""0"" cellpadding=""0"">" $shtml &= "<tr><td><input type=""radio"" name=""isBRT"" value=""0"">This listing</td></tr>" $shtml &= "<tr><td><input type=""radio"" name=""isBRT"" value=""1"" checked>Multiple listings</td></tr>" $shtml &= "<tr><td><span class=""help""> You will be able to view all listings before taking action</span></td></tr></table>" $shtml &= "<br><input type=""submit"" value=""Continue >""></form></body></html>" _IEDocWriteHTML($oIE, $shtml) _IEAction($oIE, "refresh") ;SELECT RADIO AND SUBMIT FORM $oForm = _IEFormGetCollection($oIE, 0) _IEFormElementRadioSelect($oForm, "0", "isBRT", 1, "byValue", 0) $oBtn = _IEFormElementGetCollection($oForm, 5) _IEAction($oBtn, "click") _IELoadWait($oIE) Same error, occuring because of the _IEFormElementGetCollection method: --> COM Error Encountered in test.au3 ----> $IEComErrorScriptline = 1316 ----> $IEComErrorNumberHex = 80020003 ----> $IEComErrorNumber = -2147352573 ----> $IEComErrorWinDescription = Member not found. ----> $IEComErrorDescription = ----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = ----> $IEComErrorLastDllError = 0 --> IE.au3 Error from function _IEAction, $_IEStatus_InvalidDataType Any help would be much much appreciated - I've been struggling with this for a lonnng time Thanks for all the help so far, Dale. Gradient-Filled Progress Bars UDF Link to comment Share on other sites More sharing options...
DaleHohm Posted September 11, 2006 Share Posted September 11, 2006 Thanks for the reproducer. I'll take a look. 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...
syberschmo Posted September 13, 2006 Author Share Posted September 13, 2006 Hi Dale I figured it out! A line in the HTML form is messing everything up: <input type="hidden" name="item" value="0000"> Is item a reserved word? I looked into IE.au3 (specifically _IEFormElementGetCollection) and found this line (line 1316): Return $o_object.elements.item ($i_index)oÝ÷ Ùhbr¬ºÇ¶Þ¶êçjÊ^r'ârãyËpéÈZ+I^éíëB¢Y^rب+jY^w©â×±N¬{ej)ì«·r¶¬ë0éÜjYb®¶seôTf÷&ÔVÆVÖVçDvWD6öÆÆV7Föâb33c¶ôf÷&ÒÂRoÝ÷ ØèºwmçèZ0x0¢¹®§uû¥Êy«¢+Ø¥¹±Õ±Ðí%¹ÔÌÐì)}%ÉɽÉ!¹±ÉI¥ÍÑÈ ¤((í]I%Q= U59P(ÀÌØí½%ô}% ÉÑ ¤(ÀÌØí͡ѵ°ôÅÕ½Ðì±Ðí¡Ñµ°Ðì±Ðí¡Ðì±ÐíѥѱÐíͱÐì½Ñ¥Ñ±Ðì±Ð콡Ðì±Ðí½äÐì±Ðí½É´Ñ¥½¸ôÅÕ½ÐìÅÕ½Ðí¡ÑÑÀè¼½ÝÝܹ½½±¹½´¼ÅÕ½ÐìÅÕ½ÐìµÑ¡½ôÅÕ½ÐìÅÕ½ÐíÁ½ÍÐÅÕ½ÐìÅÕ½ÐìÐìÅÕ½Ðì(ÀÌØí͡ѵ°µÀìôÅÕ½Ðì±Ðí¥¹ÁÕÐÑåÁôÅÕ½ÐìÅÕ½Ðí¡¥¸ÅÕ½ÐìÅÕ½Ðì¹µôÅÕ½ÐìÅÕ½Ðí%MA% ½µµ¹ÅÕ½ÐìÅÕ½ÐìÙ±ÕôÅÕ½ÐìÅÕ½Ðí%ÑµÍ åM±±ÉMÉ ÅÕ½ÐìÅÕ½ÐìÐì±Ðí¥¹ÁÕÐÑåÁôÅÕ½ÐìÅÕ½Ðí¡¥¸ÅÕ½ÐìÅÕ½Ðì¹µôÅÕ½ÐìÅÕ½Ðí¥Ñ´ÅÕ½ÐìÅÕ½ÐìÙ±ÕôÅÕ½ÐìÅÕ½ÐìÀÀÀÀÅÕ½ÐìÅÕ½ÐìÐìÅÕ½Ðì(ÀÌØí͡ѵ°µÀìôÅÕ½Ðì±Ðí¥¹ÁÕÐÑåÁôÅÕ½ÐìÅÕ½Ðí¡¥¸ÅÕ½ÐìÅÕ½Ðì¹µôÅÕ½ÐìÅÕ½ÐíUÍɹµÅÕ½ÐìÅÕ½ÐìÙ±ÕôÅÕ½ÐìÅÕ½ÐíÑÍÐÅÕ½ÐìÅÕ½ÐìÐì±ÐíÐíIÁ½ÉÐè±Ðì½Ðì±ÐíÈÐì±Ðíѱ½ÉÈôÅÕ½ÐìÅÕ½ÐìÀÅÕ½ÐìÅÕ½Ðì±±ÍÁ¥¹ôÅÕ½ÐìÅÕ½ÐìÀÅÕ½ÐìÅÕ½Ðì±±Á¥¹ôÅÕ½ÐìÅÕ½ÐìÀÅÕ½ÐìÅÕ½ÐìÐìÅÕ½Ðì(ÀÌØí͡ѵ°µÀìôÅÕ½Ðì±ÐíÑÈÐì±ÐíÑÐì±Ðí¥¹ÁÕÐÑåÁôÅÕ½ÐìÅÕ½ÐíÉ¥¼ÅÕ½ÐìÅÕ½Ðì¹µôÅÕ½ÐìÅÕ½Ðí¥Í IPÅÕ½ÐìÅÕ½ÐìÙ±ÕôÅÕ½ÐìÅÕ½ÐìÀÅÕ½ÐìÅÕ½ÐìÐíQ¡¥Ì±¥ÍÑ¥¹±Ðì½ÑÐì±Ðì½ÑÈÐìÅÕ½Ðì(ÀÌØí͡ѵ°µÀìôÅÕ½Ðì±ÐíÑÈÐì±ÐíÑÐì±Ðí¥¹ÁÕÐÑåÁôÅÕ½ÐìÅÕ½ÐíÉ¥¼ÅÕ½ÐìÅÕ½Ðì¹µôÅÕ½ÐìÅÕ½Ðí¥Í IPÅÕ½ÐìÅÕ½ÐìÙ±ÕôÅÕ½ÐìÅÕ½ÐìÄÅÕ½ÐìÅÕ½Ðì¡Ðí5ձѥÁ±±¥ÍÑ¥¹Ì±Ðì½ÑÐì±Ðì½ÑÈÐìÅÕ½Ðì(ÀÌØí͡ѵ°µÀìôÅÕ½Ðì±ÐíÑÈÐì±ÐíÑÐì±ÐíÍÁ¸±ÍÌôÅÕ½ÐìÅÕ½Ðí¡±ÀÅÕ½ÐìÅÕ½ÐìÐìe½ÔÝ¥±°±Ñ¼Ù¥Ü±°±¥ÍÑ¥¹Ì½ÉÑ¥¹Ñ¥½¸±Ðì½ÍÁ¸Ðì±Ðì½ÑÐì±Ðì½ÑÈÐì±Ðì½Ñ±ÐìÅÕ½Ðì(ÀÌØí͡ѵ°µÀìôÅÕ½Ðì±ÐíÈÐì±Ðí¥¹ÁÕÐÑåÁôÅÕ½ÐìÅÕ½ÐíÍÕµ¥ÐÅÕ½ÐìÅÕ½ÐìÙ±ÕôÅÕ½ÐìÅÕ½Ðí ½¹Ñ¥¹ÕÐìÅÕ½ÐìÅÕ½ÐìÐì±Ð콽ɴÐì±Ðì½½äÐì±Ð콡ѵ°ÐìÅÕ½Ðì)}%½]É¥Ñ!Q50 ÀÌØí½%°ÀÌØí͡ѵ°¤)}%Ñ¥½¸ ÀÌØí½%°ÅÕ½ÐíÉÉÍ ÅÕ½Ðì¤((íM1 PI% Just remember if anyone is trying to submit a form with an input named 'item', you will probably not be able to use _IEFormElementGetCollection with an index value. Instead, you should use _IEFormElementGetCollection to return an array and then define the form element explicitly in your code. Happy coding! Gradient-Filled Progress Bars UDF Link to comment Share on other sites More sharing options...
DaleHohm Posted September 13, 2006 Share Posted September 13, 2006 Thanks for the followup! I've never seen reserved words documented, but this is not the first time it has bitten someone. Now I can drop that nagging "gotta figure out syberschmo's form problem" ToDo... 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