Quick test professional

QTP Tips QTP codes QTP Faqs and more

How To close MsgBox Runtime

 

How To close MsgBox Runtime 

Write the below line as the first-line in your script. Set sh = CreateObject(“Scripting.Shell”) …This will create a shell object at run-time and will be available until the test ends.

If you are getting problem like ,Activex Component can’t create object Then use  Set sh =CreateObject(“WScript.Shell”)

 Now… where ever you are having “msgbox” replace it with..

sh.Popup “message content”, 5, “msg header”, (0+4)

 the above line will show the message content for 5 seconds(and vanishes after that).

The alert-box’s header will have “header info”. Last parameter(0+4) is actually two things. 0 -> show OK button in the alertBox 48 -> “!” icon… if you use 64 u will see X icon instead BTW… since u need the message to be displayed

 

 

Advertisements

February 14, 2008 - Posted by | QTP Tips and Faqs | , , , , , , , ,

13 Comments »

  1. I have tried this but its shows an error that

    Activex Component can’t create object Scripting.Shell

    Can you please tell me how to solve this problem

    Comment by J Jayarama | February 26, 2008 | Reply

  2. use Set sh =CreateObject(”WScript.Shell”)

    Comment by quicktestprofessional | February 26, 2008 | Reply

  3. This is not correct.

    Comment by qtp boss | July 12, 2008 | Reply

  4. boss,
    Its working code only.never comment anybodys work until u definitly know the truth.
    mohan kakarla

    Comment by quicktestprofessional | July 13, 2008 | Reply

  5. hi

    this is balaji

    i got a problem that i am unable to capture the class radiobutton for business, first, or economy in mercury flight reservation at run time and i am writing all the values into one file using file system object(FSO)

    can u please any body help in this regard

    thanks in advance

    regards
    balaji

    Comment by balaji | November 28, 2008 | Reply

  6. hi Mohan,

    Thanks buddy,for giving solution for closing msgbox during runtime.

    Muthu

    Comment by Muthukumar | March 17, 2009 | Reply

  7. Set sh = CreateObject(”WScript.Shell”)
    Set sh = CreateObject(”Scripting.Shell”)

    I had trouble with both these statements with an “Invalid character” error after I copied and pasted the code directly form the page. If you get this error, the problem is with the quotes. Delete them and replace them, problem solved.

    Excellent tip, though!

    Comment by Dave Rodney | April 15, 2009 | Reply

  8. Hi,
    I’m unable to run this script. I have msgbox that displays “test” as message output. I copies and pasted the above code:
    Set sh = CreateObject(Scripting.Shell)
    sh.Popup message content, 5, msg header, (0+4) “test”

    It says Invalid Character.
    Plz help.

    – A

    Comment by Abhijeet | May 6, 2009 | Reply

  9. How to close inputbox without mouse click and keyboard..

    Comment by Ramya | December 1, 2009 | Reply

  10. Hi all,

    Please can you tell me how to save a RunTime DataTable value?

    Comment by Umesh | April 6, 2010 | Reply

  11. can we use “sh.Timeout=5”

    Comment by jayachandra | May 12, 2011 | Reply

  12. Hi,
    I’m unable to run this script. I have msgbox that displays “ok” as message output. I copies and pasted the above code:
    Set sh = CreateObject(Scripting.Shell) or Set sh = CreateObject(”WScript.Shell”)
    sh.Popup message content, 5, msg header, (0+4) “test”

    It says Invalid Character

    Comment by aparna | November 10, 2011 | Reply

  13. Hi,
    I’m unable to run this script. I have msgbox that displays “ok” as message output. I copied and pasted the above code:
    Set sh = CreateObject(Scripting.Shell) or Set sh = CreateObject(”WScript.Shell”)
    sh.Popup message content, 5, msg header, (0+4) “test”

    It says Invalid Character

    Comment by aparna | November 10, 2011 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: