Steps performed
1. Open a web page where data needs to be entered programmatically 2. Retrieved Element instance by passing element Id. 3. Call SetText function in Actions instance in ArtOfTest.WebAii.TestTemplates.BaseTest class by passing element and textToSetExpected solution
Text need to be entered in the text box always.Actual Output
Text is not always entered in the text box. Some times entering correctly and sometimes s开发者_开发问答kipping it without entering the value. When debugging, observed that, the element instance is retrieved properly and SetText function is called and no exceptions are thrown. When the value is not entered, setting the control again at the top of the function and running it again will set the value in the text box.Can any one tell me the reason for this weird behaviour? Please let me know if more details are required.
Your description sounds like a timing problem. Since test scripts usually run very quickly it is easy for them to outrun your web application. If your test runs while debugging it (i.e. running slowly or single stepping) but intermittently fails when run at full speed, you are almost certainly running into a timing problem. Your web application may not be ready to accept text input at the time your test script is trying to feed the data into it, which is a very common problem if your web application is doing an AJAX postback. The easiest method to overcome such a problem is to add a fixed delay just before the SetText call. A more advanced technique is to monitor some property or element contained within your web application to detect when it's ready for input and wait for that to be set. Once that property is correctly set then call the SetText function.
Cody Telerik Technical Support Team
精彩评论