Thursday, August 28, 2014

QTP trick when object is not recognized - Mouse replay type

                When you start learning a new language or tool when you correct your first mistake you remember it forever. The human brains remember the first failure as well as the workaround really well. So when startng to learn QTP I was using online videos from http://www.itelearn.com/

I encountered the error when the object was recognized using object spy and the object properties.
When I tried to run the script I got the error "Object not found". When I consulted my good old friend "Google" I got a lot of pointers for what to do when QTP does not recognize your object,

*Check the addins are loaded.
*Try to use GetVisibleText
*Create object using decriptive programming
*Search HP knowledge base.

But my problem was the object was in repository and recognized by QTP.
The test failed during Runtime. So after research found my fix. I had to change the click type to mouse expluicitly using the below code,

Setting.WebPackage("ReplayType") = 2 'Runs mouse operations using the mouse
browser("Gmail").Page("Inbox").WebElement("COMPOSE").Click
Setting.WebPackage("ReplayType") = 1 'Runs mouse operations using the Browser events


Also remember to reset it to 1 before rest of script gets executed.

Happy learning

No comments:

Post a Comment

Useful or Not leave a comment to let me know