SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Jul 2001
    Posts
    147
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems With Using SetTrap ()

    Hi All,

    I'm trying to capture a message box that appears half way through a test case. This message box is an error message. I'm trying to use SetTrap, and for some reason it fails to capture it. Am I doing something wrong?

    I tried both these, and it still didn't work:

    1. DialogBox("~ActiveApp/[DialogBox]$MessageBox*").SetTrap("OK", 1, "**** Error - Incorrect Message Box Appeared")

    2. MessageBox.SetTrap("OK")

    ------------------
    Who Tests The Tester...
    Who Tests The Tester...

  2. #2
    Member
    Join Date
    Oct 2001
    Posts
    93
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems With Using SetTrap ()

    It is quite hard to gather what you actually want to do with the message. The first thing to do is check that the window is actually called MessageBox. You can do this with the Window Identifiers recorder.

    What I would do is check for the existance of the message box using the Exists () method. In my experience this is more robust than SetTrap and getting the same functionality as SetTrap can be done is a couple of lines:

    if MessageBox.Exists (5)
    MessageBox.OK.Click()

    By using this method you can have the script wait around to see if the window appears whereas SetTrap requires that the trap be in existance BEFORE the window is initialised.

    Hope this helps,

    Paul

    ------------------
    Paul Tucker
    Merit AT
    www.merit-at.com

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems With Using SetTrap ()

    An easy test to do for you.

    do:

    while(0==0)
    DialogBox("~ActiveApp/[DialogBox]$MessageBox*").SetTrap("OK", 1, "**** Error - Incorrect Message Box Appeared")


    now: manually invoke this window and see what happens. This function has to be very timely. From help:

    If any condition you are better off to use other means to close a window(or dialogbox, message box)


    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:43 AM.

Copyright BetaSoft Inc.