![]() |
After Login, need to check if correct - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: After Login, need to check if correct (/Thread-After-Login-need-to-check-if-correct) |
After Login, need to check if correct - mv8167 - 04-15-2011 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" RE: After Login, need to check if correct - Jay - 04-15-2011 what it the exact problem...run time error of object at line 12 or it else issue.. I am not clear with your post. RE: After Login, need to check if correct - Saket - 04-15-2011 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. RE: After Login, need to check if correct - mv8167 - 04-15-2011 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. RE: After Login, need to check if correct - mv8167 - 04-15-2011 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 RE: After Login, need to check if correct - Jay - 04-15-2011 seems like webelement object is not getting identified from your OR. Update that object, RE: After Login, need to check if correct - mv8167 - 04-15-2011 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 |