Invoke OnChange event hangs if Alert appears

2 posts, 0 answers
  1. Denis
    Denis avatar
    4 posts
    Member since:
    Dec 2011

    Posted 20 Aug 2014 Link to this post

    Hi Telerik Support Team,

    In our application we have the following scenario which need to be verified: 
    User enter a value into some input text box and change focus to another control. After verification JavaScript alert appears on the screen.

    In code it looks like:

    01 var alertDialog = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
    02 Manager.Current.DialogMonitor.AddDialog(alertDialog);
    03 Manager.Current.DialogMonitor.Start();
    04 DateInputBox.Focus();
    05 DateInputBox.Value = "01/01/20014";
    06 DateInputBox.InvokeEvent(ScriptEventType.OnChange);
    07 DateInputBox.InvokeEvent(ScriptEventType.OnBlur);
    08 alertDialog.WaitUntilHandled(15000);

    During line 06 execution JavaAcript Alert appers and script hangs on the 06 line for a long time. The only one solution is to stop test execution. 

    Do you have any suggestion how to implement the scenario?
  2. Cody
    Cody avatar
    3354 posts

    Posted 25 Aug 2014 Link to this post

    Hello Denis,

    The only solution I can think of is multi-threading. Put lines 4 - 7 into a worker thread that is spawned by the main thread. The main thread can also pass it a parameter pointing to the DateInputBox object so the worker thread doesn't have to look this up, it simply operates on the object passed into the thread as a parameter. Keep the WaitUntilHandled in the main thread which will execute concurrently with the worker thread that's setting the value and invoking the events.

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