silvanr Posted August 31, 2006 Share Posted August 31, 2006 If a button name submit, then I can't press it with _IEFormSubmit. For example: #include <IE.au3> $oIE = _IECreate("http://www.redaware.ch/shop/test.php") $oForm = _IEFormGetCollection ($oIE, 0) ;Button Click $x = _IEFormSubmit($oForm) ConsoleWrite('@@ Debug(7) : $x = ' & $x & @lf & '>Error code: ' & @error & @lf) ;### Debug Console Console output: $x = -1 What wrong? Is that a bug? Sorry, which my English is so bad. I come from Switzerland ;-) Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted August 31, 2006 Moderators Share Posted August 31, 2006 @silvanr - I'm not sure what is wrong, but here is a workaround. #include <IE.au3> $sURL = "http://www.redaware.ch/shop/test.php" $oIE = _IECreate($sURL) $oForm = _IEFormGetObjByName($oIE, "cart_quantity") $oSubmit = _IEFormElementGetObjByName($oForm, "submit") _IEAction($oSubmit, "click") Link to comment Share on other sites More sharing options...
DaleHohm Posted August 31, 2006 Share Posted August 31, 2006 There does appear to be a problem, but it is not in IE.au3 It appears taht the DOM is treating "submit" as a reserved word in that context and it gets confused and does not perform the action. The case can be simplified to this: #include <IE.au3> ; Create browser with desired content $oIE = _IECreate() $sHTML = "" $sHTML &= "<FORM action='java script:alert(""FormSubmitted"");'>" $sHTML &= "<INPUT type=submit value=submit name=submit> </FORM>" _IEBodyWriteHTML($oIE, $sHTML) ; Get form reference $oForm = _IEFormGetCollection ($oIE, 0) ; submit action is ignored _IEFormSubmit($oForm) If you change the name to something other than submit, it works. There is nothing that can be doce from IE.au3 -- big_daddy's work around is a good one. 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...
silvanr Posted September 4, 2006 Author Share Posted September 4, 2006 Many web pages use submit as name. Is there an alternative possibility? Sorry, which my English is so bad. I come from Switzerland ;-) Link to comment Share on other sites More sharing options...
silvanr Posted September 4, 2006 Author Share Posted September 4, 2006 Use this function: _IEAction ($oSubmit, "click") That works :-) For example: #include <IE.au3> ; Create browser with desired content $oIE = _IECreate() $sHTML = "" $sHTML &= "<FORM action='java script:alert(""FormSubmitted"");'>" $sHTML &= "<INPUT type=submit value=submit name=submit> </FORM>" _IEBodyWriteHTML($oIE, $sHTML) ; Get form reference $oForm = _IEFormGetCollection ($oIE, 0) $oSubmit = _IEFormElementGetCollection ($oForm, 0) ; submit action is ignored ;~ _IEFormSubmit($oForm) _IEAction ($oSubmit, "click") _IELoadWait ($oIE) Sorry, which my English is so bad. I come from Switzerland ;-) Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted September 4, 2006 Moderators Share Posted September 4, 2006 @silvanr - That was the workaround you were already given. 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