Sign in to follow this  
Followers 0

Automatically log into

1 post in this topic

#1 ·  Posted (edited)


I am trying to log into using AutoIt.
There are several examples, but none of them work with the current webpage.

This is my code (because the username and password are not valid ;-) , I comment the "button click" out.):

#include <IE.au3>

Local $oIE = _IECreate("")
_IELoadWait ($oIE)
_IELinkClickByText($oIE, "Sign in")

$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "loginfmt")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "idSIButton9")

$username = ""
$password = "testpassword"

_IEAction ($o_login, "focus")
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)

;_IEAction ($o_signin, "click")

When I run the code I get the following:


The value being set is garbeled with "PlaceholderText".
Because of this, the username and password are invalid.

Here screenhot of the placeholders text:


When you start typing in one of the fields, the placeholder text is automatically deleted.
When you set a value it stays.

I found a workaround, to set focus on the element and send the username as an keyboard input to the field,
but I would like a clean solution based on variables.

So, does anyone now how to do this?





Edited by Jemboy
typing error

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

  • Similar Content

    • Simpel
      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: 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 $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.
    • Simpel
      By Simpel
      I wanted to use _GetLogonTime() by guinness (
      #include <Date.au3> #include <Array.au3> ConsoleWrite(_GetLogonTime() & @LF) Func _GetLogonTime($sUserName = @UserName, $sComputerName = @ComputerName) ; Idea by trancexx: 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
    • 31290
      By 31290
      Hi Guys, 
      Hope you're fine today!
      I'd like to create a small GUI that, when clicking a button, the password set in the GUICtrlCreateInput is revealed and when the click is released, the password is hidden again. W8/10 style in fact...
      Here's what I have so far:
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) f_RemedyUpdate() While 1 Sleep(10) Wend Func f_RemedyUpdate() $gMailCreds = GUICreate("SEE CHECKLISTS", 300, 140) GUISetBkColor($Color_White) GUISetFont(8.5, 700, 0) GUICtrlCreateLabel("Password required for your account" , 5, 10) GUICtrlCreateLabel("Your Password:", 10, 70, 100, 30) $g_PassInput = GUICtrlCreateInput("", 110, 66, 150, 20, $ES_PASSWORD) GUICtrlSetColor(-1, 0x800080) $g_ShowPassButton = GuiCtrlCreateButton ("", 270, 67, 16, 16, $BS_ICON) GUICtrlSetImage(-1, "C:\eye.ico") GuiCtrlSetOnEvent ($g_ShowPassButton, "f_ShowPassword") $g_SubmitBtn = GUICtrlCreateButton ("Submit", 120, 100, -1, -1, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent(-1, "f_SendMail") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") GUISetState(@SW_SHOW) EndFunc Func f_ShowPassword() $s_PWD = GuiCtrlRead ($g_PassInput) If $s_PWD = "" Then Msgbox (64, "Your password", "You did not type any password") Else Msgbox (64, "Your Password", "You typed --> " & $s_PWD & " <-- as password.") EndIf EndFunc I've enclosed the small ico file I'm using 
      Thanks in advance for any help provided
    • Graeme
      By Graeme
      I have code to enter password using the setting $ES_PASSWORD. It seems that with this setting you can't enter more than the letters that fill box. Can anyone tell me how to enter more characters?
      GUICreate("Password Test",500,200) $Input = GUICtrlCreateInput("Password",10,20,40,50,$ES_PASSWORD) GUISetState(@SW_SHOW,"Password Test") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE,"Password Test") ExitLoop EndSwitch WEnd If GUICtrlRead($Input) <> "" Then MsgBox(0,GUICtrlRead($Input),"Done") With this code you can only enter 4 characters of password.
    • Blank517
      By Blank517
      Hi, I would like to make a login script with SQLite. The database looks like this:
      _SQLite_Exec(-1, "CREATE TABLE Users (id INT(8) NOT NULL, username VARCHAR(30) NOT NULL, password VARCHAR(255) NOT NULL, permission INT(8) NOT NULL, PRIMARY KEY (id)); CREATE UNIQUE INDEX 'user_name_unique' ON 'Users' ('username' );") _SQLite_Exec(-1, "INSERT INTO Users(id, username, password, permission) VALUES ('0', 'default', 'password', '0');")
      theoretically I should make a query in this way, right?
      _SQLite_Query (-1, "SELECT id FROM Users WHERE username = '" & $ Recv [1] & "' AND password = '" & $ Recv [2] & "';", $ hQuery)
      but then I do not know how to know if you have found the 'id'