Jump to content

Duplicate IE Form Element


Recommended Posts

Used IEBuilder to determine that this form has duplicate submit buttons with the Name "submit_btn"

Index Tag Name Extra Information Object Type

18 INPUT submit_btn Form Input Type: submitValue: Okay to Submit Payment DispHTMLInputElement

19 INPUT submit_btn Form Input Type: submitValue: Change Information DispHTMLInputElement

When I run this line

$oSelect7 = _IEFormElementGetObjByName ($oFormID4, "submit_btn", 18)

MsgBox(0, "", $oSelect7)

It returns a 0 with a no match found error. Any ideas how I can get a match? I thought by adding the Index value of 18 it would return the right form element but its not working.

Link to comment
Share on other sites

If there are two by that name , valid index values will be 0 and 1.

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

If there are two by that name , valid index values will be 0 and 1.

Dale

IEBuilder says the index is 18 for the first submit button. See attached IEBuilder screen capture.

I tried 0 and 1 for the index value and I still do not get the correct object.

My code for the problem section is:

$oFormID4 = _IEFormGetObjByName ($oIE, 1)

$oSelect7 = _IEFormElementGetObjByName ($oFormID4, "submit_btn", 1)

_IEAction ($oSelect7, "click")

I keep getting this error.

IE.au3 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch

Link to comment
Share on other sites

IEBuilder says the index is 18 for the first submit button. See attached IEBuilder screen capture.

I tried 0 and 1 for the index value and I still do not get the correct object.

My code for the problem section is:

$oFormID4 = _IEFormGetObjByName ($oIE, 1)

$oSelect7 = _IEFormElementGetObjByName ($oFormID4, "submit_btn", 1)

_IEAction ($oSelect7, "click")

I keep getting this error.

IE.au3 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch

It is a matter of context. It is not index 18 in the context of form elements of a specific name, it is likely index 1.

Your IEFormGetObjByName call doesn't look right. The 2nd parameter should be the form name in quotes, not a numeric value. That is likely the source of your trouble. If you are not getting a warning, it could be that it is matching an incorrect form because of the datatype mismatch... I'll look into this.

Dale

Edit: Type

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

It is a matter of context. It is not index 18 in the context of form elements of a specific name, it is likely index 1.

Your IEFormGetObjByName call doesn't look right. The 2nd parameter should be the form name in quotes, not a numeric value. That is likely the source of your trouble. If you are not getting a warning, it could be that it is matching an incorrect form because of the datatype mismatch... I'll look into this.

Dale

Edit: Type

The form name did not exist as you can see from the IEBuilder screen captures so I used the Index value of 1 to grab the form. I saw a recent post from you that described the way to do this. It worked great up until I got to this particular web page.

When I needed to get the Form Element there are no IDs so I tried to use the form element index value which is 18 for the element I want. It does not give a match. I then tried 0 and 1 and still no match.

Is my logic not right?

Thanks for your help!!

Edited by vcrocca
Link to comment
Share on other sites

_IEFormGetCollection ...

Thanks! That command works fine. I can get the form from the web page. What does not work is getting the Form Elements. None of them have IDs so I tried to use the Index valu instead and it does not work. It looks like a bug as I believe I am entering it correctly. It just will not return an index value of 18.

Link to comment
Share on other sites

If you post the script you have so far it would make it easier to help. Also provide a link or some source of the page you are trying to interact with.

Thanks I wish I could. Its a sensitive web page that I cannot post.

I tried enumerating the Form Elements by using _IEFormElementGetCollection using code similar to the attched code but although it tells me there are 19 objects in the collection it does not list any. Again all of the form elements are missing an entry in the ID field so there is nothing it can find. Is there another way to get the Form Element except the ID field?

#include <IE.au3>

$oIE = _IECreate ("http://www.google.com")

$oForm = _IEFormGetObjByName ($oIE, "f")

$oForms1 = _IEFormElementGetCollection ($oForm, 0)

$oForms2 = _IEFormElementGetCollection ($oForm)

MsgBox(0, "Forms Info", "There are " & @extended & " form elements on this page")

For $oForms1 In $oForms2

MsgBox(0, "Form Info", $oForms1.name)

Next

Link to comment
Share on other sites

Thanks I wish I could. Its a sensitive web page that I cannot post.

I tried enumerating the Form Elements by using _IEFormElementGetCollection using code similar to the attched code but although it tells me there are 19 objects in the collection it does not list any. Again all of the form elements are missing an entry in the ID field so there is nothing it can find. Is there another way to get the Form Element except the ID field?

#include <IE.au3>

$oIE = _IECreate ("http://www.google.com")

$oForm = _IEFormGetObjByName ($oIE, "f")

$oForms1 = _IEFormElementGetCollection ($oForm, 0)

$oForms2 = _IEFormElementGetCollection ($oForm)

MsgBox(0, "Forms Info", "There are " & @extended & " form elements on this page")

For $oForms1 In $oForms2

MsgBox(0, "Form Info", $oForms1.name)

Next

Thanks to everyone who helped I figured it out.

A simple missing

_IELoadWait ($oIE) after an _IEAction statement

fixed the issue. Its the simple things. ;-)

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...