User Tag List

Results 1 to 3 of 3

Thread: wait for

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    wait for


    how could I implement by best way the following:

    I have a progress, which takes a while.
    then I wrote wait(10) for example.

    But if it takes longer, the next step will be executed.

    How can I implement a function, which will wait until the progress is finished?

    Thanks a lot,

  2. #2
    SQA Knight
    Join Date
    Jun 2008
    Post Thanks / Like
    3 Post(s)
    1 Thread(s)

    Re: wait for

    You'll have to find some object to watch then loop until it no longer exists or whatever the scenario happens to be for the app.

  3. #3
    Advanced Member
    Join Date
    Mar 2007
    Salt Lake City, UT, USA
    Post Thanks / Like
    1 Post(s)
    0 Thread(s)

    Re: wait for

    First, try to avoid simply using wait statements. When you use wait(10) and your application is ready in 3 seconds, you will still wait the full 10, wasting 7 seconds. And when you need 15 seconds, wait(10) won't solve your problem, as you've pointed out.

    Instead, consider using waitproperty() methods that you can apply to just about any object.

    So, for example, maybe you just clicked a Submit button, and now your application is communicating with a database, then with your file server to load a new page. And once this new page opens, you want to click a Confirm button (for example) but the whole process usually takes anywhere from 5 seconds to 20 seconds.

    In this example, you would put a waitproperty("enabled",30) on the Confirm button. This will tell QTP to wait up to 30 seconds for the Confirm button to be enabled. The neat thing about waitproperty() is that if the property is found before the time you specify, QTP will move on to the next line without waiting the rest of the time - so it only waits as long as it has to.

    As a rule, put the waitproperty() method on the very first object you want to interact with after the wait. Since you are interacting with that object first, there is no reason to wait for some other object - wait for the one you need first.

    Also, as a side note, consider the .exit() method, which does much the same thing, but waits for an object to exist (note that just because it exists doesn't mean you can interact with it - for example, some applications might instantiate the Continue button first but make it disabled until the rest of the data loads).
    "The last 10% of any software project will take 90% of the budgeted time. The first 90% will take the other 90%"



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 04:09 PM.

Copyright BetaSoft Inc.