Ignacio Posted September 12, 2016 Share Posted September 12, 2016 (edited) Hi there, i have been using the autlogin script from this post https://www.autoitscript.com/forum/topic/102119-website-autologin-with-internet-explorer/ It works good, at least until i tried to login to my school student account (http://mictlantecuhtli.itmatamoros.edu.mx/), at first i thought it didnt log because you had to click a button first so the user and password forms appear (but that wanst the case, since other website that work in a similar fashion log just fine) the i checked the form names from the website, to see if where the same for the script values, and ideed they are, it doesnt even trigger the error options from the script. So i ran out of ideas to see resolve the problem, any help would be really appreciated. code below in case no one wants to get sidetracked Spoiler expandcollapse popup#include <IE.au3> $Url = 'http://www.autoitscript.com/forum/index.php?app=core&module=global§ion=login' $User = 'user' $Pwd = 'pwd' $test = _IEAutoLogin($Url, $User, $Pwd) Func _IEAutoLogin($sUrl, $sUsername, $sPwd) ;funkey 09.09.09 $oIE = _IECreate($sUrl) _IEErrorNotify(False) _IEErrorHandlerRegister() $oForms = _IEFormGetCollection($oIE) If @error Then Return SetError(1, _IEErrorHandlerDeRegister(), $oIE) ;'no forms --> no login' Else $Index = 0 For $oForm In $oForms $oFormElements = _IEFormElementGetCollection($oForm) If IsObj($oFormElements) Then $IndexElement = 0 For $oElement In $oFormElements If $oElement.Type = 'password' Then $oPwd = _IEFormElementGetObjByName($oForm, $oElement.Name) _IEFormElementSetValue($oPwd, $sPwd) For $i = $IndexElement - 1 To 0 Step -1 $oUser = _IEFormElementGetCollection($oForm, $i) If $oUser.Type = 'text' Then _IEFormElementSetValue($oUser, $sUsername) ExitLoop EndIf Next If $oForm.action <> "0" And Not StringInStr($oForm.action, '.php') Then ;submit _IEFormSubmit($oForm, 0) _IELoadWait($oIE) Else ;click For $i = $IndexElement + 1 To $IndexElement + 10 ;check the next 10 elements $oButton = _IEFormElementGetCollection($oForm, $i) If $oButton.Type = 'submit' Then _IEAction($oButton, "click") ExitLoop EndIf Next EndIf Return SetExtended(_IEErrorHandlerDeRegister(), $oIE) EndIf $IndexElement += 1 Next EndIf $Index += 1 Next EndIf Return SetError(2, _IEErrorHandlerDeRegister(), $oIE) ;no password-field found EndFunc ;==>_IEAutoLogin Edited January 10, 2018 by Ignacio Link to comment Share on other sites More sharing options...
genius257 Posted September 12, 2016 Share Posted September 12, 2016 It may be because the login form is in a frame, pointing to the url: http://mictlantecuhtli.itmatamoros.edu.mx/acceso.php if i check for number of forms detected ti says zero: ConsoleWrite($oForms.Length&@CRLF) So either you need to update the script to look within frames/iframes, or access the page directly. If change the URL to acceso.php, I get: Introduce un NIP numérico Hope this solves your problem My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Ignacio Posted September 12, 2016 Author Share Posted September 12, 2016 8 hours ago, genius257 said: It may be because the login form is in a frame, pointing to the url: http://mictlantecuhtli.itmatamoros.edu.mx/acceso.php if i check for number of forms detected ti says zero: ConsoleWrite($oForms.Length&@CRLF) So either you need to update the script to look within frames/iframes, or access the page directly. If change the URL to acceso.php, I get: Introduce un NIP numérico Hope this solves your problem I tried it whit the acceso.php url, and it does loginm but i think it clicks something else that i dont have access to, because a meessage from the website appears and kicks me out. So i will check the frames/iframes as you suggested, now i dont need to run blind with the script. Thanks for kind the answer (n.n)/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now