Morten Røgenes
Top achievements
Rank 1
Morten Røgenes
asked on 10 May 2010, 11:55 AM
Hi again,
I have a drop down list with an async postback to the server every time the ddl's value is set, but since the test continue to update other fields while there is a postback in progress, these fields lose their values when the postback is finished.
At least this is what I think is happening.
When I add a Thread.Sleep(1000) the test runs as expected.
I've tried ActiveBrowser.WaitUntilReady(); but that does not help.
Is there another way (than Thread.Sleep(1000)) to find out when the browser is ready to continue?
I have a drop down list with an async postback to the server every time the ddl's value is set, but since the test continue to update other fields while there is a postback in progress, these fields lose their values when the postback is finished.
At least this is what I think is happening.
When I add a Thread.Sleep(1000) the test runs as expected.
I've tried ActiveBrowser.WaitUntilReady(); but that does not help.
Is there another way (than Thread.Sleep(1000)) to find out when the browser is ready to continue?
10 Answers, 1 is accepted
0
Morten Røgenes
Top achievements
Rank 1
answered on 10 May 2010, 12:58 PM
After some more testing and trying to find a workaround, I found that the Thread.Sleep() wasn't what resolved the problem, but a wait for the dropdownlist was.
Pages.Page1.DropDownList1.Wait.ForExists(); |
0
Hi Morten,
Thanks for the update and sharing the solution in the forums.
Actually, this is one advantage of WebUI Test Studio -- it will call the Element.Wait.ForExists() (with some default timeout) automatically as part of the element action execution for you. With the framework you need to handle those element updates as well.
Regards,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thanks for the update and sharing the solution in the forums.
Actually, this is one advantage of WebUI Test Studio -- it will call the Element.Wait.ForExists() (with some default timeout) automatically as part of the element action execution for you. With the framework you need to handle those element updates as well.
Regards,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Morten Røgenes
Top achievements
Rank 1
answered on 10 May 2010, 02:47 PM
Thanks for the reply
I have done some more testing now, and got a few more comments
I have the WebUI Test Studio, and when I preview the code for the test, I can see that
However, without the extra Element.Wait.ForExists(); where Element could be any control on the page, the value entered in TextBox1.Text disappear.
I then tried "Customize step in code" on the step that set TextBox1.Text.
Now Wait.ForExists() was removed from the code preview, so I added it, but TextBox1 still lost its value.
I added another Wait.ForExists(), and now the test behaved as expected.
It seems that the step needs an additional Wait.ForExists() for some unknown reason.
Check the attached file for its properties.
Could some additional javascript eventhandler added to the TextBox1.change() mess things up?
This textbox does also have a AjaxControlToolkit.MaskedEditExtender and a AjaxControlToolkit.CalendarExtender added to it
I have done some more testing now, and got a few more comments
I have the WebUI Test Studio, and when I preview the code for the test, I can see that
Pages.Page1.TextBox1.Wait.ForExists(); |
//is being called before |
Page.Page1.TextBox1.Text = ""; |
However, without the extra Element.Wait.ForExists(); where Element could be any control on the page, the value entered in TextBox1.Text disappear.
I then tried "Customize step in code" on the step that set TextBox1.Text.
Now Wait.ForExists() was removed from the code preview, so I added it, but TextBox1 still lost its value.
I added another Wait.ForExists(), and now the test behaved as expected.
It seems that the step needs an additional Wait.ForExists() for some unknown reason.
Check the attached file for its properties.
Could some additional javascript eventhandler added to the TextBox1.change() mess things up?
txtFrom.change(function() { |
var date1 = parseDate(txtFrom[0].value); |
var date2 = parseDate(txtTo[0].value); |
if(date1 > date2 || txtTo[0].value == '') |
{ |
txtTo[0].value = txtFrom[0].value; |
} |
}); |
This textbox does also have a AjaxControlToolkit.MaskedEditExtender and a AjaxControlToolkit.CalendarExtender added to it
0
Hello Morten,
Yes, that makes sense. The internal Wait.ForExists() call may return too soon or we simply don't detect regular postback. Since you mention the AJAX Toolkit controls they probably perform callbacks which you will need to handle additionally. For example when a partial page update occurs try adding an additional WaitFor verification for the element or its expected value being updated -- this will wait for some time until the value is *silently* updated.
I hope this helps!
Best wishes,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Yes, that makes sense. The internal Wait.ForExists() call may return too soon or we simply don't detect regular postback. Since you mention the AJAX Toolkit controls they probably perform callbacks which you will need to handle additionally. For example when a partial page update occurs try adding an additional WaitFor verification for the element or its expected value being updated -- this will wait for some time until the value is *silently* updated.
I hope this helps!
Best wishes,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Morten Røgenes
Top achievements
Rank 1
answered on 12 May 2010, 01:53 PM
Hi Konstantin, and thanks for the reply
It does not seem to be a problem with the AjaxControlToolkit or the other javascript added, because I get the same problem when only a dropdownlist and a textbox is used.
An extra Wait.ForExists() does not always work either since it may take a long time getting the response from the server.
It works great if the selected value on one ddl updates the elements that are shown in a different ddl.
Then I can just add a "Wait for InnerText Contains", before the next step that will select in the second ddl.
If the second ddl already contains this element, however, the next step quickly pass, and the next few steps before the server responds will be executed as well.
But when the server finally responds it resets all the values that has been set since the postback started.
In my current scenario, there is nothing else that changes, so i cant "Wait for anything to update".
Could you please help me with a workaround for this?
Waiting, and hoping that the postback is done before continuing is not a good enough solution for me.
It does not seem to be a problem with the AjaxControlToolkit or the other javascript added, because I get the same problem when only a dropdownlist and a textbox is used.
An extra Wait.ForExists() does not always work either since it may take a long time getting the response from the server.
It works great if the selected value on one ddl updates the elements that are shown in a different ddl.
Then I can just add a "Wait for InnerText Contains", before the next step that will select in the second ddl.
If the second ddl already contains this element, however, the next step quickly pass, and the next few steps before the server responds will be executed as well.
But when the server finally responds it resets all the values that has been set since the postback started.
In my current scenario, there is nothing else that changes, so i cant "Wait for anything to update".
Could you please help me with a workaround for this?
Waiting, and hoping that the postback is done before continuing is not a good enough solution for me.
0
Hello Morten,
Try using the SelectByValue() method of the HtmlSelect with invokeOnChangeEvent parameter 'true':
This will wait until the postback completes. Let us know if this helps.
All the best,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Try using the SelectByValue() method of the HtmlSelect with invokeOnChangeEvent parameter 'true':
DropDownList1.SelectByValue(
"Item2"
,
true
);
This will wait until the postback completes. Let us know if this helps.
All the best,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Morten Røgenes
Top achievements
Rank 1
answered on 18 May 2010, 12:40 PM
Hi again,
Sorry for being so difficult, hehe, but with a partial postback, I don't get your suggestion to work.
The test only knows the text to select, but I assume SelectByText does the same as SelectByValue
Im cooking up something for you to test to reproduce this issue.
Sorry for being so difficult, hehe, but with a partial postback, I don't get your suggestion to work.
The test only knows the text to select, but I assume SelectByText does the same as SelectByValue
Im cooking up something for you to test to reproduce this issue.
0
Hi Morten,
Yes, if you can send a sample project replicating the problem that would be perfect. Thanks for your time!
Regards,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Yes, if you can send a sample project replicating the problem that would be perfect. Thanks for your time!
Regards,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Morten Røgenes
Top achievements
Rank 1
answered on 24 Jun 2010, 12:04 PM
Hi again,
I finally had the time to continue working on this.
Is there anywhere "private" I can share this with you?
I finally had the time to continue working on this.
Is there anywhere "private" I can share this with you?
0
Hi Morten,
Please feel free to submit a formal support ticket with any private information/project you think is related to the problem.
Kind regards,
Konstantin Petkov
the Telerik team
Please feel free to submit a formal support ticket with any private information/project you think is related to the problem.
Kind regards,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items