Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

if not working correctly

$
0
0
Hi All,

I am trying to automate some websites but I am facing an issue trying to validate if the login screen is been shown or not.

Local $userName = 'user'
Local $password = 'password'
Local $oIE = _IECreate()
WinSetState("Blank Page", "", @SW_MAXIMIZE)
_IENavigate($oIE, "http://url.com")
_IELoadWait($oIE)
_IEGetObjByName($oIE, "ssousername")
AutoItSetOption("SendKeyDelay", 50)
If @error = 0 Then
enterUserNameAndPassword($userName, $password)
EndIf
Local $oNew = _IEGetObjById($oIE, "New")
_IEAction($oNew, "click")
_IELoadWait($oIE)


func enterUserNameAndPassword( $userName, $password)
Local $oUserId = _IEGetObjByName($oIE, "ssousername")
AutoItSetOption("SendKeyDelay", 50)
_IEAction($oUserId, "focus")
Send($userName)
Send("{TAB}")
Send($password)
Local $oLogin = _IEGetObjById($oIE, "loginButton")
_IEAction($oLogin, "click")
_IELoadWait($oIE)
EndFunc


I just wan to execute the enterUserNameAndPassword function if the get username object was successed and if not I want to continue with the next steps. But when I run the script the lines Send("{TAB}") and Send($password) are being executed and I do not know why. Does anybody know what is going on?

Really appreciate your help!

Thanks,
axy108.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>