How to wait until dynamic values generated

2 posts, 0 answers
  1. Huang
    Huang avatar
    3 posts
    Member since:
    Jul 2013

    Posted 01 Aug 2013 Link to this post


    Do we have 'Wait until' function or similar function to resolve the following case? It's better to provide some sample code to me.

    1. It is a HTMLSelect control, its values of drop down list are generated dynamically from database by an event.
    2. The value list will be generated for some time.(2-3s).
    3. I would like to wait for the value list generation and then execute further test action in my automation scripts.

    My current solution is using "Thread.sleep" to wait for the items generation. But I think it's not good solution. I cannot estimate the exact time for the list generation. Is there better way to execute further testing as long as the values of drop down list have already been generated?
  2. Boyan Boev
    Boyan Boev avatar
    1072 posts

    Posted 05 Aug 2013 Link to this post

    Hello Huang,

    Thank you for contacting us.

    If it is a standard HTML select control you can wait for an option via a coded step:

    Manager.Current.ActiveBrowser.WaitForElement(new HtmlFindExpression("tagname=option","value=ValueYouWantToWaitFor"), 20000, false);

    If the drop down uses an Ajax requests you can also use wait for ajax. Please check out this article.

    Let me know if this helps.

    Boyan Boev
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top