Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
After Login, need to check if correct
#1
Not Solved
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:

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
Reply
#2
Not Solved
what it the exact problem...run time error of object at line 12 or it else issue..

I am not clear with your post.
Reply
#3
Not Solved
What does it in the variable 'var_Exist' when it comes to line 12?
I dont think its required here, try using it without that variable
like - IF Browser("WisdomLogin").Page("WisdomLogin").WebElement("Login Failure.").Exist then
also make sure webelement login failure is there in your repository as mentioned in the error message.

Reply
#4
Not Solved
Jay,

The error ocurs as soon as I press the Run button. The script runs but I can tell it is not running correctly. The "If" statements dont seem to be used.

L


Saket,

The var_Exists came from when I built a checkpoint to see if the Login.gif element appears. I add the If statement as I have three things to check. If the gif image shows, I know that I successfully logged in. If not, I will find (in a seperate location) a message of "Login Failed". If neither of those are found and nothing is found (the Env is down, etc) then I Exit the script. I will remove the var_Exists and see how it goes.

How can I add this webelement to my repository? In Spy I see it as a gif image withe the properties of an image.
Reply
#5
Not Solved
Still getting the same message that the WebElement "Login Failure" is not found. But if it is False, I want the next If to be tested. Am I going about this incorrectly?

See my attachment that Spty does find the web element but only if the login id or password is incorrect.

thxx all


Attached Files
.doc   Login Failure element.doc (Size: 49 KB / Downloads: 60)
Reply
#6
Not Solved
seems like webelement object is not getting identified from your OR. Update that object,
Reply
#7
Not Solved
I tried to update the OB, i'm not sure if I did it correctly though.

In an If...Then ... ElseIf statement, can we use Checkpoints or Sync points? When I run my test scripts without being in a If...Then statement, the images and text are seen. If I run the test script with the Checkpoints in an If..Then... the code does not see the images/text checkpoints.

Code:
If [Browser("WisdomLogin").Page("Wisdom CTE").Image("Wisdom").WaitProperty "file name", "WelcometoWisdom.gif", 10000] Then
        'Login Passed -  Logout only appears when the login is successful
         Reporter.ReportEvent micPass, "Login", "Login Passed"    
ElseIf [Browser("WisdomLogin").Page("WisdomLogin").WebElement("Login Failure.").WaitProperty "innerhtml", "Login Failure", 10000] Then
        'Login Failed
         Reporter.ReportEvent micPass, "Login", "Login Failed - Bad User ID or Password"
         Browser("WisdomLogin").Close
Else
'     'None of the object exist
        Reporter.ReportEvent micFail, "Login", "Login Failed. Unknown error"
        Browser("WisdomLogin").Close
End If
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation Login & logout in Siebel and clicking pop-up button yuetling926 7 10,696 07-09-2014, 10:43 PM
Last Post: hhamilton
  Unable to Click on Login Button Paurav 1 3,157 07-03-2014, 05:27 AM
Last Post: supputuri
  for help.Run a test to login,and then it didn't jump to another page maosilu 0 2,586 11-01-2013, 01:27 PM
Last Post: maosilu
  The recorded text output not appear on the correct row on the results datatable trance07 0 2,182 09-25-2013, 08:05 PM
Last Post: trance07
  Best method to test Login validation defcon3 2 3,448 05-29-2012, 04:02 PM
Last Post: defcon3

Forum Jump:


Users browsing this thread: 1 Guest(s)