Header Ads

Be careful while using SystemUtil.Run method

Be careful while using SystemUtil.Run method.....................
For projects, Tester generally uses SystemUtil -an inbuilt object of QTP- to launch application.
The sad part of this method is that it can not differentiate between explorer and iexplorer
As a result we generally get the below written Error thrown from QTP.
“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 It was discovered that the problem lies with the SystemUtil.Run method. I was using
SystemUtil.Run “explorer”, .
When I changed that to

SystemUtil.Run “iexplore”, script started running fine. I guess while using explorer, QTP expects a file path and not a HTTP path on it.

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)

Even one of my friend Nilanjan recommended that instead of using System.Util .or run method.It is better to use the “cmd” that is the command format (simple dos)
Type path through QTP and run the file u want.
This is the most reliable approach,he suggested.
What do u say?

Powered by Blogger.