Jump to content

Waiting for page to load in IE before form gets submitted


Recommended Posts

I'm trying to submit a form (name = spk). The form has a button input element, but it has no name, so I've been trying to just use _IEFormSubmit(). Here is my code:

$oFrame = _IEFrameGetObjByName($oIE, "top")
    $oForm = _IEFormGetObjByName($oFrame, "spk")
    $oSelect = _IEFormElementGetObjByName($oForm, "h")
    _IEFormElementOptionselect($oSelect, $inputselection, 1, "byText"); just selecting a drop down menu with a user defined $inputselection
    _IEFormSubmit($oForm)

The problem is, this method is repeatedly submitting the form, this little bit of code is part of a large Do Until loop. I want to submit this form, let it load, then move on to my next task, all within the Do loop. I've used this very same code on different webpages that are quite similar, but the form submit button had a name, so using an _IEAction("click") worked perfectly. Any ideas?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

I'm trying to submit a form (name = spk). The form has a button input element, but it has no name, so I've been trying to just use _IEFormSubmit(). Here is my code:

$oFrame = _IEFrameGetObjByName($oIE, "top")
    $oForm = _IEFormGetObjByName($oFrame, "spk")
    $oSelect = _IEFormElementGetObjByName($oForm, "h")
    _IEFormElementOptionselect($oSelect, $inputselection, 1, "byText"); just selecting a drop down menu with a user defined $inputselection
    _IEFormSubmit($oForm)

The problem is, this method is repeatedly submitting the form, this little bit of code is part of a large Do Until loop. I want to submit this form, let it load, then move on to my next task, all within the Do loop. I've used this very same code on different webpages that are quite similar, but the form submit button had a name, so using an _IEAction("click") worked perfectly. Any ideas?

Take a look at _IEFormElementGetCollection and get a refernce by index instead of name.

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

As in have _IEFormElementGetCollection run into an array and search for the element I am interested in?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

No, as in specify the optional zero-based index parameter to select an element by index instead of name.

Dale

Edit: typo

Edited 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

Ok. For a first time index user, to get the index would I write the collection to an array to get an array index, and the index for the _IEFormElementGetCollection() would be the same as the index for the array?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Ok. For a first time index user, to get the index would I write the collection to an array to get an array index, and the index for the _IEFormElementGetCollection() would be the same as the index for the array?

The example in the helpfile for _IEFormElementGetCollection() shows you how to use the index parameter. If you pass an index of -1 (the default) you get a collection object (it is like an array, but a differnt construct entirely). If you pass an index of 0 or positive integer you get a reference to a single element (like you would with using _IEFormElementGetObjByName).

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

I worked it out by trial and error, but I'll try looking in the helpfiles for examples on indexing.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...