Jump to content
Sign in to follow this  
duckling78

How do you input text into an IE input field?

Recommended Posts

duckling78

How do you input text into an IE input field?

There's an example in the help file for the _IEFormElementGetObjByName function but we can't get it to work with our web page.

What's the second parameter in that function mean?

#include <IE.au3> 
_IEFormElementGetObjByName ( ByRef $o_object, $s_name [, $i_index = 0] )

Share this post


Link to post
Share on other sites
Muchuchu

$s_name represents the name of the form or in this case the name of the inputbox

Just to clarify it's not the type of form (ie. inputbox) but the name given to that specific form

Edited by Muchuchu

Share this post


Link to post
Share on other sites
duckling78

I just figured it out hehe... I needed to use the "View source" on the web page and find the "name=" values in the html tags for the controls. This was the first time I automated a web page, it's pretty cool though :)

#include <IE.au3>

$oIE = _IEAttach("Welcome", "Title")    ;Attach to currently open IE window if it is on the web page already.
If @error == 7 Then ;If no window is found...
    $oIE = _IECreate("http://webpage.com/") ;...open a new IE window.
EndIf

_IELoadWait($oIE, 500)  ;Wait for the page to finish loading.

$oForm = _IEGetObjById($oIE, "loginform")   ;Get the form "Name" (view source on the page, look for "<Form" and look for the "name=" value for the name value).
$oLogin = _IEFormElementGetObjByName($oForm, "email_login") ;The "email_login" is the name of the inputbox for the input (also in the view source).
_IEFormElementSetValue($oLogin, "username would go here")   ;Set the login to equal this value.

Share this post


Link to post
Share on other sites
kuya

can someone help me to create 1 system to login into this game?

www.theninja-rpg.com .. cause this game need to varified image first..

(sorry about my bad language)

I just figured it out hehe... I needed to use the "View source" on the web page and find the "name=" values in the html tags for the controls. This was the first time I automated a web page, it's pretty cool though :)

#include <IE.au3>

$oIE = _IEAttach("Welcome", "Title")    ;Attach to currently open IE window if it is on the web page already.
If @error == 7 Then ;If no window is found...
    $oIE = _IECreate("http://webpage.com/") ;...open a new IE window.
EndIf

_IELoadWait($oIE, 500)  ;Wait for the page to finish loading.

$oForm = _IEGetObjById($oIE, "loginform")   ;Get the form "Name" (view source on the page, look for "<Form" and look for the "name=" value for the name value).
$oLogin = _IEFormElementGetObjByName($oForm, "email_login") ;The "email_login" is the name of the inputbox for the input (also in the view source).
_IEFormElementSetValue($oLogin, "username would go here")   ;Set the login to equal this value.

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  

×