SPONSORS:






User Tag List

Results 1 to 9 of 9
  1. #1
    Junior Member
    Join Date
    Oct 1999
    Location
    Mountain View, CA
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    wait for active window

    Hello everybody,

    The application I'm writing script for is taking very long time to appear on the screen. It can be 30-50 seconds or more, depending on the CPU clock. I'm trying to use Desktop.GetActive() inside the while loop, but it failed because desktop is empty. On the other hand I wouldn't like to use sleep function because of different CPU clock. Can someone give me an idea here?
    Please email me at slava.maslenitsyn@risk.sungard.com if you could suggest me something.
    Thank you very much.
    slava

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

  2. #2
    Member
    Join Date
    Mar 2000
    Location
    Cary, NC 27511
    Posts
    41
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: wait for active window

    The application I'm writing script for is taking very long time to appear on the screen. It can be 30-50 seconds or more...
    ---------------------------------

    You can use this technique

    while (! WindowOject.Exist() )
    Sleep(1)

    already explained in this note:
    http://www.qaforums.com/boards/ubb/F...ML/000420.html
    -------------------
    Alex.
    -------------------
    ------------------------

  3. #3
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: wait for active window

    Though in some circumstance the Exists() method is not sufficient to make the script wait until your window is ready - our application under test regularly puts up windows which return true to Exists() but which are clearly not ready; so we have a function which tries Sleep() followed by SetActive(), in a loop which continues for a number of cycles or until the window is genuinely ready for use.

  4. #4
    Member
    Join Date
    Jul 1999
    Location
    Raleigh, NC
    Posts
    35
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: wait for active window

    Always ensure that you include some method of break-out of your While() loop otherwise you risk the potential for causing infinite loops that hang your script indefinitely... for example if you app never loads.

  5. #5
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: wait for active window

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Slava:
    Hello everybody,

    The application I'm writing script for is taking very long time to appear on the screen. It can be 30-50 seconds or more, depending on the CPU clock. I'm trying to use Desktop.GetActive() inside the while loop, but it failed because desktop is empty. On the other hand I wouldn't like to use sleep function because of different CPU clock. Can someone give me an idea here?
    Please email me at slava.maslenitsyn@risk.sungard.com if you could suggest me something.
    Thank you very much.
    slava

    <HR></BLOCKQUOTE>


    You can also download QAPLib #1 from the downloads site (http://qadownloads.com) under the Segue category.

    In that library you'll find WaitFor() function, this function takes a Window to wait for and it defaults to 20 seconds timeout, you can also passin a different timeout.

    Example:
    WaitFor (MainWin, 90)

    Another way to do what you need and only if this is an invokation of an application, you can do the following:
    In your Agent Options, under Timing, set your AppReadyTimeout to more than 60 seconds. or use: Agent.SetOption (OPT_APPREADY_TIMEOUT, 90)

    Hope that helps...



    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

  6. #6
    Junior Member
    Join Date
    Oct 1999
    Location
    Mountain View, CA
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: wait for active window

    Thank you everyone who gave me a hand.
    slava

  7. #7
    Junior Member
    Join Date
    Mar 2000
    Location
    Waltham, MA, USA
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: wait for active window

    Instead of passing in the number of seconds to wait in the Exists() method, why not create a little while loop like:

    while (!wWindow.Exists())
    sleep(1)

    This way, SilkTest will just sleep until the window exists(opens), and it doesn't matter how long or short it will take for the application to "fire up."

    I've used this quit a bit, successfully on several applications.

  8. #8
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: wait for active window

    mlabbe: Instead of having to wait a second, WaitFor does that all the time, and it waits for a 0.2 of a second (that even is an optional param).

    Try it out

    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

  9. #9
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: wait for active window

    Here's the WaitFor() function

    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

 

 

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 08:55 PM.

Copyright BetaSoft Inc.