04-15-2011, 02:44 AM
I created a login script, but I also want to check 3 things 1) Failed loggin (due to bad password) 2) Or that the web app actualy loaded 3) Or a succesful loggin. The first two should exit the test, while the 3rd continues on.
But, even when the test succesfully logs in, I get a warning message about the Login Failure. Am I using the wrong If-Then loop? I only want one of the three actions to take place.
Error Merssage:
The "Login Failure." object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.
Line (12): "If var_Exist = Browser("WisdomLogin").Page("WisdomLogin").WebElement("Login Failure.").Exist Then".
Tip: If the objects in your application have changed, the Maintenance Run Mode can
help you identify and update your steps and/or the objects in your repository.
My code:
But, even when the test succesfully logs in, I get a warning message about the Login Failure. Am I using the wrong If-Then loop? I only want one of the three actions to take place.
Error Merssage:
The "Login Failure." object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.
Line (12): "If var_Exist = Browser("WisdomLogin").Page("WisdomLogin").WebElement("Login Failure.").Exist Then".
Tip: If the objects in your application have changed, the Maintenance Run Mode can
help you identify and update your steps and/or the objects in your repository.
My code:
Code:
Browser("WisdomLogin").Page("WisdomLogin").WebEdit("userid").Set "17871"
Browser("WisdomLogin").Page("WisdomLogin").WebEdit("password").SetSecure "4d9f2f8fc89871c32e204eec390cef6c84e1ef19756a5b30"
Browser("WisdomLogin").Page("WisdomLogin").WebButton("Log In").Click
If var_Exist = Browser("WisdomLogin").Page("WisdomLogin").WebElement("Login Failure.").Exist Then
'Login Failed
Reporter.ReportEvent micPass, "Login", "Login Failed - Bad User ID or Password"
Browser("WisdomLogin").Close
ElseIf var_Exist = Browser("WisdomLogin").Page("Wisdom CTE").Image("Wisdom").Exist Then
'Login Passed - Logout only appears when the login is successful
Reporter.ReportEvent micPass, "Login", "Login Passed"
Else
'None of the object exist
Reporter.ReportEvent micFail, "Login", "Login Failed. Unknown error"
Browser("WisdomLogin").Close
End If