This is a migrated thread and some comments may be shown as answers.

How to wait until dynamic values generated

1 Answer 133 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Huang
Top achievements
Rank 1
Huang asked on 01 Aug 2013, 11:21 AM
Hi,

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?

1 Answer, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 05 Aug 2013, 08:42 AM
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.

Regards,
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Huang
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Share this question
or