This articles gives the details about the MsgBox and Print functions in QTP.
Most of us might have came across the function MsgBox which is used to display the variable values,text values etc., during our script execution. But from QTP 9.x series HP has introduced a statement called "Print". The purpose of the Print statement is similar to the MsgBox.
MsgBox: It's a VBScript function which is used to display the information during run session in the form of pop up. The script execution will be stopped automatically once the MsgBox pop up is displayed. Because the pop up window will not be closed automatically. We may need to close it manually or can have driver script to close the pop up.So, we can't expect that the run session will be completed automatically when used MsgBox.So, when running batch session, we need to make sure that MsgBox function is not used in our script.
Print: Print statement is used to print the information in a print log during run session and it'll not affect the script execution. It means that the Print log will be printed along with the run session.So, while running the batch session we can use Print statement which will not pause the script execution.
Syntax: Print "<<msg>>" & <<variable name>>
Ex: Print "User Name is :"& Uname
how can print is showing in when we save the script in .vbs as Type mismatch
ReplyDelete