Sign in to follow this  
Followers 0
stupidngai

How to use _IEFormElementGetObjByName without name?

12 posts in this topic

I used DebugBar to find the infomation of the field in website:

<INPUT id=standardPeriodChooserPrompt_toDate onchange=' htmlInputs_onchangeUpdateNode( genericXSLTCallerRenderer3Renderer.model, "/*/To", this.value, "","",true, this ); reValidateData();' value=2009-01-01 bcdMandatory="false" bcdBaseClass="editFormTextField" bcdDataType="date">

I found that no name for this field! How can I use _IEFormElementGetObjByName($o_form, "name")??

I try to use id as name but fail.

Since it is the company internal web system, so it is useless to post the website as you cannot access to it...

Hope somebody can help.

Share this post


Link to post
Share on other sites



Hi, Welcome to the forums!

I would try something like so:

#include <IE.au3>

$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEGetObjById($oIE, "q"); 2nd Param = Name/ID
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

It's always good to post your code, etc. to show what you've tried- it makes it easier for us, and who knows, you might be very close!

Cheers,

Brett

Share this post


Link to post
Share on other sites

Please read the remarks section in the helpfile for _IEFormElementGetObjByName


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

It does have a name

<INPUT id=standardPeriodChooserPrompt_toDate onchange=' htmlInputs_onchangeUpdateNode( genericXSLTCallerRenderer3Renderer.model, "/*/To", this.value, "","",true, this ); reValidateData();' value=2009-01-01 bcdMandatory="false" bcdBaseClass="editFormTextField" bcdDataType="date">

There is however another way to retrieve this information by going through _IETagNameGetCollection and following the example in the help file there


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

It does have a name

<INPUT id=standardPeriodChooserPrompt_toDate onchange=' htmlInputs_onchangeUpdateNode( genericXSLTCallerRenderer3Renderer.model, "/*/To", this.value, "","",true, this ); reValidateData();' value=2009-01-01 bcdMandatory="false" bcdBaseClass="editFormTextField" bcdDataType="date">

There is however another way to retrieve this information by going through _IETagNameGetCollection and following the example in the help file there

Note that .id and .name are different properties. So no, this does not have a name, but it does have a useful id.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Almost...

In fact the DOM does something unexpected here and the a Name will match either a name= or id= attribute. On the other hand, ID will only match id=

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

Please read the remarks section in the helpfile for _IEFormElementGetObjByName

I read the Help and see the remarks...

Remarks

If the desired form element does not have a name or ID, _IEFormElementGetCollection to get a reference by index

In fact I don't understand how to get a reference by index... is it a number like 0, 1, 2, 3??

But I try it and get nothing eventually...

Here is my code:

$oIE2 = _IENavigate($oIE, $MIP_OB_TT)

Sleep(10000)

$o_form2 = _IEFormGetCollection($oIE2)

$o_from = _IEFormElementGetObjByName($o_form2, 0)

$o_to = _IEFormElementGetObjByName($o_form2, 1)

_IEFormElementSetValue($o_from, "2009-01-01")

_IEFormElementSetValue($o_to, "2009-01-04")

Share this post


Link to post
Share on other sites

Are you running your code in SciTe? If not, you are missing a lot. In particular, taht code should be returning helpful warning and error messages to the console -- please don't ignore them.

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

Almost...

In fact the DOM does something unexpected here and the a Name will match either a name= or id= attribute. On the other hand, ID will only match id=

Dale

Huh. Learn something new every day... and I'm done for today!

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Huh. Learn something new every day... and I'm done for today!

:)

This question is still unsolved

What is the matter, bros?

Why don't we have try "_IEGetObjById"? - This is not optimal but usable, right?

OR think of Dale suggest (remarks of "_IEFormGetCollection")

Here:

*/ no ID or Name needed to identify form/element but its order of appearance in the returned HTML page (and this order is something we always have)

#include <IE.au3>

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

$oForm = _IEFormGetCollection ($oIE, 0) ; I realize my desired form is the 1st form (forms/elements order starts with 0)

$oQuery = _IEFormElementGetCollection ($oForm, 1) ; similarly, I realize my desired form element is the 2st element of the form $oForm

_IEFormElementSetValue ($oQuery, "AutoIt IE.au3") ; no care, this is the problem of identification

_IEFormSubmit ($oForm) ; no care, this is the problem of identification

OR make an improve to IE.au3 add to it the accompany of "_IEFormGetObjByName" - "_IEFormGetObjById"

For this, we need help of the author of IE.au3

Share this post


Link to post
Share on other sites

The point was that the name function will match either name or id. Did you try something like this?

$oQuery = _IEFormElementGetObjByName($oForm, "standardPeriodChooserPrompt_toDate")

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

And the point was also to use _IEFormGetCollection (that is what the Remarks tell you about)

#include <IE.au3>
$oIE = _IECreate("www.google.com")
$oForms = _IEFormGetCollection($oIE)
ConsoleWrite("Forms found on page: " & @extended & $CRLF)
For $oForm in $oForms
    ConsoleWrite(_IEPropertyGet($oForm, "outerhtml" & @CRLF & "-----------------" & @CRLF)
Next

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

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