For one of my projects, I was using SystemUtil -an inbuilt object of QTP- to launch my application. For about 5 times script-replay was perfect, the 6th times onwards QTP started throwing an error:
Cannot identify the object parent. Make sure that……
Object spy on browser bar revealed that it was being recognized as window instead of browser! Some more R & D and I discovered that the problem lies with the SystemUtil.Run method. I was using SystemUtil.Run “explorer”, <URL>. When I changed that to SystemUtil.Run “iexplore”, <URL> script started running fine. I guess while using explorer, QTP expects a file path and not a HTTP path on it. Having said that, I am still not sure how it ran fine for the first few times.
To launch an application, I think a better alternative would be to create a shell object and launch applications using its Run method. It will take about 4 lines of code.(including declaration and destruction of shell object)
Probably a good time to change my habit of writing the shortest possible code while programming!
If you want to keep track of further articles on UFT (QTP). I recommend you to subscribe by Email and have new UFT articles sent directly to your inbox.