Micro Focus QTP (UFT) Forums
Skip button using Script - 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: Skip button using Script (/Thread-Skip-button-using-Script)

Pages: 1 2


Skip button using Script - manishnangalia - 07-19-2012

At the time of execution of script, i get an on error dialog box, so i need to navigate through it manually, Is there any way to automate that process as well, as per the condition, I want to navigate those errors automatically, by lookin at the error message i want to navigate


RE: Skip button using Script - Ankesh - 07-19-2012

use "on error resume next" statement. See QTP help for reference.


RE: Skip button using Script - manishnangalia - 07-19-2012

But i dont want to skip all the errors, i just want to skip some particular message, can we not identify the text on the error dialog box


RE: Skip button using Script - Shridevi.Salagare - 07-20-2012

you can put a simple if condition ..if that dialog box appears then perform the action.


RE: Skip button using Script - Ankesh - 07-20-2012

Yes sure you can just capture the message in the error dialog box if they are application related pop ups.

Use the code
Code:
strMsg=Browser("").Page("").Dialog("").GetRoProperty("PopupDialogText") 'get the txt displayed,chnge the objecthierarcrhy as per ur need.
if Instr(strMsg,"<Your Message that you want to chk>")>0 Then
  //your code to perform operation if the msg is as expected
End IF

Above code will work only for application related popups, if you want to work on the QTP error popup, u'll have to use On Error resume next statement. You can chk for the error number there as a condition.


Regards,
Ankesh


RE: Skip button using Script - manishnangalia - 07-20-2012

Ok is that so, i was talking about QTP error pop up and not app based, popup, how can i check the number of the qtp based error window?


RE: Skip button using Script - ravi.gajul - 07-20-2012

You can use Err object to capture error number and error message
Please see the example below
Code:
On error resume next
systemutil.run "C:\flight.exe"
msgbox "Error Number :"&Err.number &vbcrlf & "Error Description:"& Err.Description

Regards,
Ravi


RE: Skip button using Script - manishnangalia - 08-01-2012

But the question is, say der are two line of code
Line1
Line2

and in line 2 qtp throws an error
how can i skip those errors dat too depending on its desc.


RE: Skip button using Script - sshukla12 - 08-01-2012

Could you please post your code.

Regards,
Sankalp


RE: Skip button using Script - manishnangalia - 08-01-2012

Its a custome code for SAP in which its not able to find the Object or so, so QTP throws an error, am asking for such cases