In my application,I have a dialog box where QTP has click on Close button to close the popup.But I couldn't able to close it. The objects are recognised in the OR but when I run the script from the starting of the scenario it is failing to click on the dialog box. When I seperately execute only that line it is able to close the dialog box. Any thoughts regarding this. Also tried highlighting the window.,written the code in DP, but no luck.
Any chance this is a timing issue? You say when you separately execute the line of code it works - that seems to say that the OR has the dialog and the close button and your line of code that clicks the button is valid (in other words, it doesn't sound like a failure to recognize the objects). So what if your code is trying to click too soon, before the dialog or close button are fully instantiated by your application?
To test it, just put a Wait 20 before the line in question. If that works, then we can try to insert more sophisticated synchronization like a WaitProperty statement for "Enabled" on the object you're trying to click, before you click it.
"The last 10% of any software project will take 90% of the budgeted time. The first 90% will take the other 90%"