Jump to content
Sign in to follow this  

Automate login

Recommended Posts


I am looking for a way to automate login to a Internet Banking website (https://bank.tymedigital.co.za/) and all of the examples that I could found still do not solve my issue with this website.

In order to Login, the user need to enter their Identity Number and Password the click the Login button.

Inspecting the Elements in Chrome are as follow;

Identity Number

<input autocomplete="username" placeholder="Please enter your South African ID number" maxlength="13" type="tel" class="form-control" value="">


<input autocomplete="current-password" placeholder="Enter password" type="password" class="form-control" value="">


<button type="button" class="btn btn-yellow btn-block">Login</button>

Any assistance or directing me to a solution will be appreciated.

Thank you,


Share this post

Link to post
Share on other sites

Looks like there is only one form, so look at form _IEFrameGetCollection

Then there is IETagNameGetCollection with "input". 

I am too tired to test your site, maybe tomorrow...


Share this post

Link to post
Share on other sites
10 minutes ago, Danp2 said:

Hi @Lourens,

Welcome to the forum. Please post additional details so that we can better understand the issue. Things like --

  • Which browser you are using
  • What isn't working as expected?
  • Post your code (use the <> icon at the top of the editor)


Browser - Internet Explorer

The form fields has no name or id and I can not use _IEGetObjByName or _IEGetObjById

Usually I would use _IEGetObjByName and set the value of the form field with _IEFormElementSetValue as below;

Local $oUsername = _IEGetObjByName($oIE, "username")
    Local $oPassword = _IEGetObjByName($oIE, "password")

    _IEFormElementSetValue($oUsername, "username")
    _IEFormElementSetValue($oPassword, "password")

Since _IEGetObjByType is not an option, I do not know how to proceed. Using _IEFormGetCollection inform me that there is one form on the page, however, no other useful information is returned that I can use (or I am doing something that I am not suppose to do).

Thank you,


Share this post

Link to post
Share on other sites


I have found another script by @funkey

I have modified the script, however, the form does not recognize the values submitted even though it is visible in the form fields.

#include <IE.au3>

$Url = 'https://bank.tymedigital.co.za/'
$User = '0000000000000'
$Pwd = 'This_Is_Not_The_Password'

$test = _IEAutoLogin($Url, $User, $Pwd)

Func _IEAutoLogin($sUrl, $sUsername, $sPwd)

    $oIE = _IECreate($sUrl)
    $oForms = _IEFormGetCollection($oIE)
    If @error Then
        Return SetError(1, _IEErrorHandlerDeRegister(), $oIE)
        $Index = 0
        For $oForm In $oForms
            $oFormElements = _IEFormElementGetCollection($oForm)
            If IsObj($oFormElements) Then
                $IndexElement = 0
                For $oElement In $oFormElements

                    For $i = $IndexElement - 1 To 0 Step -1
                        $oPwd = _IEFormElementGetCollection($oForm, $i)
                        If $oPwd.Type = 'password' Then
                            _IEFormElementSetValue($oPwd, $sPwd)

                    For $i = $IndexElement - 1 To 0 Step -1
                        $oUser = _IEFormElementGetCollection($oForm, $i)
                        If $oUser.Type = 'tel' Then
                            _IEFormElementSetValue($oUser, $sUsername)

                    For $i = $IndexElement + 1 To $IndexElement + 10
                        $oButton = _IEFormElementGetCollection($oForm, $i)
                        If $oButton.Type = 'button' Then
                            _IEAction($oButton, "click")

                    $IndexElement += 1
            $Index += 1
EndFunc   ;==>_IEAutoLogin


Attached is a screen shot of the error - it still produce the same error whether a valid id number is submitted or not. When an invalid values are submitted the error will be "Invalid SAID or password".

Thank you,



Edited by Lourens
Part of explanation lost on posting.

Share this post

Link to post
Share on other sites

Right... I was just testing with this --

#include <IE.au3>

$oIE = _IECreate("https://bank.tymedigital.co.za/)")
$oForm = _IEFormGetCollection($oIE, 0)
$oUser = _IEFormElementGetCollection($oForm, 0)
$oPass = _IEFormElementGetCollection($oForm, 1)
_IEFormElementSetValue($oUser, "12345678")
_IEFormElementSetValue($oPass, "abcdefgh")

It's possible that there is underlying events that need to be triggered for the login to work correctly.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By vargheseg
      I have a web page which  has  somewhere from 90-100 records any time. So one has to scroll from from certain height to bottom using scroll bar on the right or using the down key. Is there any functionality to take a single screenshot and give .jpeg file.  Any previous links or direction will be very helpful for me
      George V
    • By Simpel
      I wanted to use _GetLogonTime() by guinness (https://www.autoitscript.com/forum/topic/19370-autoit-wrappers/?do=findComment&comment=942069).
      #include <Date.au3> #include <Array.au3> ConsoleWrite(_GetLogonTime() & @LF) Func _GetLogonTime($sUserName = @UserName, $sComputerName = @ComputerName) ; Idea by trancexx: http://www.autoitscript.com/forum/topic/113611-if-isadmin-not-detected-as-admin/ Local $aRet = DllCall("netapi32.dll", "long", "NetUserGetInfo", "wstr", $sComputerName, "wstr", $sUserName, "dword", 11, "ptr*", 0) _ArrayDisplay($aRet) If @error Or $aRet[0] Then Return SetError(1, 0, False) Local $sHours = DllStructGetData(DllStructCreate("ptr;ptr;ptr;ptr;dword;dword;dword;ptr;ptr;dword;dword;dword;dword;ptr;dword;ptr;dword;dword;byte;dword", $aRet[4]), 18) DllCall("netapi32.dll", "long", "NetApiBufferFree", "ptr", $aRet[4]) Return _DateAdd("h", "-" & $sHours, _NowCalc()) EndFunc ;==>_GetLogonTime It always returns false.
      I displayed $aRet:
      $aRet[4] shouldn't be 0x0000000000000000 right? Any help?
      Regards, Conrad
    • By tommytx
      ConsoleWrite("Hello Dolly on Line 1" & @CRLF) #include <IE.au3> ConsoleWrite("Hello Dolly on Line 5" & @CRLF) Local $oIE = _IECreate("www.autoitscript.com") ConsoleWrite("Hello Dolly on Line 10" & @CRLF) Can anyone put me on the right track to troubleshoot this one.. the IE browser is not opening.. it is not my primary browser since FF is but that has not been a problem in the past.. it all seems to work including compile but the generation of the IE browser.. Never had any problem before.. below is the results of the run.. any ideas on where I might look.. that is the only error i get and its only after a 30 second delay.. I suppose a time out..
      ; >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "G:\show_pos.au3\test.au3"
      ; Hello Dolly on Line 1
      ; Hello Dolly on Line 5
      ; --> IE.au3 T3.0-2 Error from function _IECreate,  (Browser Object Creation Failed)
      ; Hello Dolly on Line 10
      ; >Exit code: 0    Time: 30.46
    • By ohaya
      I am still really new with AutoIT.  We are using it to automate logging into web sites and I have encountered problems with focus.  The target web page is configured to put the cursor into the first text field (username) when the page is loaded, and when I run the AutoIT script, which does the log in seems like it is just not starting where I expect it to be.  
      I have been kind of using ToolTip() to kind of help with debugging, but now I am wondering if the calls to ToolTip() are causing the focus to be messed up.  
      For example, at least visually, when the ToolTip() is called, I can see the cursor disappear from the web page text field and they when I do anything that is supposed to send keystrokes, they are going off somwhere else ("never-neverland").
      But when I remove some of the ToolTip() calls, it works correctly.
      So the questions I have are:
      1) Do the ToolTip() calls interfere with/change where the focus on the target page are?
      2) In general, what are the "rules" for where ToolTip can be used "safely" (== doesn't interfere with focus)?
    • By Simpel
      after I recognized that some of my scripts fail if they are at windows startup I researched for a solution. Problem could be fixed if I wait about 120 seconds after login. So how to measure this?
      #include-once #include <AD.au3> #include <Date.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SecondsAfterLogin ; Description ...: Returns how many seconds are gone since last login ; Syntax ........: _SecondsAfterLogin() ; Parameters ....: None ; Return values .: Success - Integer of seconds ; Failure - 0, sets @error to 1 ; Author ........: Conrad Zelck ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _SecondsAfterLogin() Local $sDate Local $iSec $sDate = __GetLogonTime() ; UTC If @error Then $sDate = __GetLogonTime_AD() ; local time If @error Then Return SetError(1, 0, 0) Else $sDate = __LocalTime($sDate) ; UTC to local time EndIf $iSec = __TimeDifference($sDate) Return $iSec EndFunc #region - INTERNAL_USE_ONLY Func __GetLogonTime($sUserName = @UserName, $sComputerName = @ComputerName) ; Idea by trancexx: http://www.autoitscript.com/forum/topic/113611-if-isadmin-not-detected-as-admin/ Local $aRet = DllCall("netapi32.dll", "long", "NetUserGetInfo", "wstr", $sComputerName, "wstr", $sUserName, "dword", 11, "ptr*", 0) If @error Or $aRet[0] Then Return SetError(1, 0, 0) Local $sSeconds = DllStructGetData(DllStructCreate("ptr;ptr;ptr;ptr;dword;dword;dword;ptr;ptr;dword;dword;dword;dword;ptr;dword;ptr;dword;dword;byte;dword", $aRet[4]), 10) DllCall("netapi32.dll", "long", "NetApiBufferFree", "ptr", $aRet[4]) Local $sLastLogon = _DateAdd('s', Number($sSeconds), "1970/01/01 00:00:00") Return $sLastLogon EndFunc Func __GetLogonTime_AD() Local $iSuccess = _AD_Open() If $iSuccess = 1 Then Local $sDate = _AD_GetLastLoginDate() $sDate = __NumberDate_StringDate($sDate) _AD_Close() Return $sDate Else Return SetError(1, 0, 0) EndIf EndFunc Func __NumberDate_StringDate($sDate) Local $y, $m, $d, $h, $min, $s $y = StringMid($sDate,1, 4) $m = StringMid($sDate,5, 2) $d = StringMid($sDate,7, 2) $h = StringMid($sDate,9, 2) $min = StringMid($sDate,11, 2) $s = StringMid($sDate,13, 2) $sDate = $y & "/" & $m & "/" & $d & " " & $h & ":" & $min & ":" & $s Return $sDate EndFunc Func __LocalTime($sDate) Local $iTimeZoneOffset Local $aTimeZone = _Date_Time_GetTimeZoneInformation() If $aTimeZone[0] <> 2 Then $iTimeZoneOffset = ($aTimeZone[1]) * -1 Else $iTimeZoneOffset = ($aTimeZone[1] + $aTimeZone[7]) * -1 EndIf $iTimeZoneOffset /= 60 ; in hours Local $sHour = StringMid($sDate, 12, 2) $sHour += $iTimeZoneOffset $sDate = StringLeft($sDate, 11) & $sHour & StringRight($sDate, 6) Return $sDate EndFunc Func __TimeDifference($sDate) Local $sNow = _NowCalc() Local $sDiff = _DateDiff("s", $sDate, $sNow) Local $iDiff = Number($sDiff) Return $iDiff EndFunc #endregion - INTERNAL_USE_ONLY I had to look what kind of login it is. Some of my computers are logging in with active directory and other not.
      Here is an example:
      #include <SecondsAfterLogin.au3> Local $iSec = _SecondsAfterLogin() MsgBox(0, '', "Time since last login: " & _HHMMSS($iSec, "s")) Exit Func _HHMMSS($iTime, $sType = "ms") If $sType = "s" Then Local $sHHMMSS = StringFormat("%.2d:%.2d:%.2d", (Floor($iTime / 3600)), (Floor(Mod($iTime,3600) / 60)), (Mod(Mod($iTime,3600),60))) Else Local $sHHMMSS = StringFormat("%.2d:%.2d:%.2d", (Floor($iTime / 3600000)), (Floor(Mod($iTime,3600000) / 60000)), (Mod(Mod($iTime,3600000),60000) / 1000)) EndIf Return $sHHMMSS EndFunc I hope someone find it useful.
      Regards, Conrad
      P.S. Review is welcome.
  • Create New...