Sign in to follow this  
Followers 0
Hello Me You

_IEFormGetObjByName()

6 posts in this topic

This is my first script with IE. (I want to login in a site)

I searched the html of the page but can't find the _IEFormGetObjByName("name of the form").

Is the form name located anywhere specific in the source?

Oh, and the site is http://www.noeman.org/gsm/

Thanks if you can find the name for me.

Here is my source that I am working on:

$oIE = _IECreate("http://www.noeman.org/gsm/")

_IELoadWait($oIE)

$o_form = _IEFormGetObjByName($oIE, "i need the name")
$o_username = _IEFormElementGetObjByName($o_form, "vb_login_username")
$o_password = _IEFormElementGetObjByName($o_form, "vb_login_password")

_IEFormElementSetValue($o_username, "my user name")
_IEFormElementSetValue($o_password, "my password")

_IEFormSubmit($o_form)

Random

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

That form does not have a name. As you can see in the source below "<!-- login form -->", it only has action, method and onsubmit values.

If you are the owner of that bulletin board, or know the owner of that bulletin board, you should change the login template through the vB Admin CP and include a name with the form.

Alternatively you could count how much times you need to press the TAB key to get to the the username field. Then use the Send command to send that amount of tabs. Then also use that command to enter the username and password for you and press the enter key to submit the form.

Edit: I just noticed that the username field has accesskey "u" set. So if you send a ALT+U keystroke simulation, the cursor will automatically jump to the username field. This should do the trick then:

Send("!uusername{TAB}password{ENTER}")
Edited by iNFERiON

Share this post


Link to post
Share on other sites

The IE.au3 way of getting a reference to a form without a name is using _IEFormGetCollection and use the index parameter. Forms have a source-order index starting with 0.

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

I have checked it. With firefox when you right-click on a page and click Page Info, it shows the forms. But this fool form does not have a name. Any suggestion?


Random

Share this post


Link to post
Share on other sites

The IE.au3 way of getting a reference to a form without a name is using _IEFormGetCollection and use the index parameter. Forms have a source-order index starting with 0.


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

Give this a try......

#include <IE.au3>
_IEErrorHandlerRegister("MyErrFunc")
$oIE = _IECreate("http://www.noeman.org/gsm/")

_IELoadWait($oIE)

$o_form = _IEFormGetCollection ($oIE, 0)   ;document.forms.item(0)   <----- referance of the form indexed based
$Username = _IEFormElementGetObjByName ($o_form,"vb_login_username")
$Password = _IEFormElementGetObjByName ($o_form,"vb_login_password")

_IEFormElementSetValue($Username,"Hasher")
_IEFormElementSetValue($Password,"123456")
Sleep(10000)
_IEFormSubmit($o_form)

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

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