Hi,
I'm trying to code out auto fill by the "Class" name of a webpage. I have done some trial and errors but all resulted in failures. Quite frankly I'm really at a loss and confused state right now on how to code it or is it even possible. Any advise is fully appreciated.
Following is my original code:
#include <Constants.au3>
#include <IE.au3>
If $CmdLine[0] < 2 Then
MsgBox($MB_OK, "Usage", "ps_Cisco SON <username> <password>")
Else
CiscoSON_login($CmdLine[1], $CmdLine[2])
EndIf
Func CiscoSON_login($username, $password)
Local $ie = _IECreate("https//10.9.11.2", 1)
; COMMENT OUT THIS SECTION IF NOT REQUIRED
Local $oIE = _IEAttach("Cisco SON")
_IELinkClickByText($oIE, "Continue to this website (not recommended).")
If @error > 0 Then
Local $i = 0
Do
Sleep(500)
$i = $i + 1
$ie = _IEAttach("Cisco SON")
Until VarGetType($ie) == "Object" Or $i >= 10
EndIf
If VarGetType($ie) == "Object" Then
$hwnd = _IEPropertyGet($ie, "hwnd")
WinSetState($hwnd, "", @SW_MAXIMIZE)
; $login_form = _IEFormGetObjByName($ie, "login_form")
$username_field = _IEGetObjByClass($ie, "internal_login_form_username")
$password_field = _IEGetObjByClass($ie, "internal_login_form_password")
;$login_button = _IEGetObjByName($ie, "trig_1")
;Might need to change these
_IEFormElementSetValue($username_field, $username)
_IEFormElementSetValue($password_field, $password)
Send("{ENTER}")
;_IEFormSubmit($login_button)
WinWaitClose($hwnd)
Else
MsgBox($MB_OK, "Cisco SON scripr Failure", "Automation failed to automate the login to Cisco SON. If this problem persists please contact your Automation Administrator.")
EndIf
EndFunc