Sign in to follow this  
Followers 0
silvanr

Submit dosn't work

6 posts in this topic

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 ;-)

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

Many web pages use submit as name.

Is there an alternative possibility?


Sorry, which my English is so bad. I come from Switzerland ;-)

Share this post


Link to post
Share on other sites

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 ;-)

Share this post


Link to post
Share on other sites

@silvanr - That was the workaround you were already given. :P

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0