Sign in to follow this  
Followers 0
Hergonoway

Can't set value and submit on IE page

3 posts in this topic

Hi (I'm french -> sorry for my english)

I tried to use IE.au3 to login on a site ...

But it really doesn't work at all

here's the HTML code :

<form method="post" action="app?action=security.loginAction" name="security.login">
...
<input class="formFieldNoWidth" type="text" maxlength="80" size="30" value="" name="userName"/>
...
<input class="formFieldNoWidth" type="password" maxlength="80" size="30" value="" name="passWord"/>
...
<input class="formButtonLogin" type="submit" value="Connexion" name="submit"/>
...
</form>

so I tried with this Autoit code

#include <IE.au3>
$sURL = "http://XXXmysiteXXXX.com/"
$sLogin = "test"
$sPassword = "test"

; Creation de l'instance IE dans la variable Objet $oIE
$oIE = _IECreate()

; Acces à Clarity
_IENavigate($oIE, $sURL)
_IELoadWait($oIE)

; Récupération des objets à remplir
$oFormLogin = _IEFormGetObjByName($oIE, "security.login")
$oLogin = _IEFormElementGetObjByName($oFormLogin, "userName")
$oPassword = _IEFormElementGetObjByName($oFormLogin, "passWord")

; Remplissage du login et mot de passe
_IEFormElementSetValue($oLogin, $sLogin)
_IEFormElementSetValue($oPassword, $sPassword)

; Envoi de la commande submit
_IEFormSubmit($oFormLogin)

Exit

IEFormGetObjByName, and IEFormElementGetObjByName return 0 :/ and @error is set to 0

I don't see where I am wrong.

Here is a site with the same login start page and the same html code : https://ike.mantech.com/niku/app?action=npt.overview

Help.

Share this post


Link to post
Share on other sites



This works...

#include <IE.au3>
$sURL = "https://ike.mantech.com/niku/app?action=npt.overview"
$sLogin = "test1"
$sPassword = "test2"

; Creation de l'instance IE dans la variable Objet $oIE
$oIE = _IECreate()

; Acces à Clarity
_IENavigate($oIE, $sURL)
_IELoadWait($oIE)

; Récupération des objets à remplir
$oFormLogin = _IEFormGetObjByName($oIE, "security.login")
$oLogin = _IEFormElementGetObjByName($oFormLogin, "userName")
$oPassword = _IEFormElementGetObjByName($oFormLogin, "passWord")

; Remplissage du login et mot de passe
_IEFormElementSetValue($oLogin, $sLogin)
_IEFormElementSetValue($oPassword, $sPassword)

Sleep(3000) ; to make sure

; Envoi de la commande submit
$oButton = _IEFormElementGetObjByName($oFormLogin, "submit")
_IEAction ( $oButton, "click" )


Exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

WOOOOO

I'm in the twilight zone xD

"Thx" a lot :D

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