OnBeforeUnload dialog handler not working

8 posts, 0 answers
  1. Paulo
    Paulo avatar
    12 posts
    Member since:
    Jun 2013

    Posted 03 Jul 2013 Link to this post

    Hi,

    i'm testing a silverlight application, that pops up when the browser closes, at the end of the test. 
    This dialog asks if I want to stay or leave the page.

    When I record the test, that dialog was recorded as a OnBeforeUnload dialog, and a handler was put as a step. But, when running the test, it fails on that step

    '03-07-2013 14:51:29' - 'Fail' : 2. Handle 'OnBeforeUnload' dialog.
    ------------------------------------------------------------
    Failure Information:
    ~~~~~~~~~~~~~~~
    Timed out waiting '15000' msec. for any dialog to be handled '1'
    InnerException:
    System.TimeoutException: Timed out waiting '15000' msec. for any dialog to be handled '1'
       at ArtOfTest.WebAii.Win32.Dialogs.BaseDialog.WaitUntilAnyHandled(IEnumerable`1 dialogs, Int32 handleCount, Int64 timeoutMilliseconds, Boolean resetHandleCount)
       at ArtOfTest.WebAii.Design.IntrinsicTranslators.Descriptors.DialogHandlerDescriptor.Execute(Browser browser)
       at ArtOfTest.WebAii.Design.IntrinsicTranslators.Descriptors.DialogHandlerDescriptor.Execute(IAutomationHost browser)
       at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep(Int32 order)


    i disabled this recorded step, and added a new one, manually through the dialogs menu, but the result was the same.

    in order to workaround this issue, I created a code step, and put inside of it the following code:
    public void Logout_CodedStep1()
    {
        OnBeforeUnloadDialog dialog = OnBeforeUnloadDialog.CreateOnBeforeUnloadDialog(ActiveBrowser, DialogButton.OK);
        Manager.DialogMonitor.AddDialog(dialog);
    }


    My question is, shouldn't that onbeforeUnload Handler work, instead of have to create a new code step with those two lines?
  2. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 08 Jul 2013 Link to this post

    Hello Paulo,

    I am sorry to hear you are experiencing this behavior. Well done on finding a workaround for this problem. The recorded step itself should work and in order to investigate this further we might need access to the dialog in question if possible. You can also try increasing the HandleTimeout value a bit more. 
    There is another value I would like you to increase a bit - Initialization Time (refer to the screenshot attached) - this is not a timeout but rather a delay that happens right before the handling of the dialog begins. The idea is to give the browsers some time to show the notification bar. You could also try to increase this one. The default is 250 milliseconds.

    Regards,
    Ivaylo
    Telerik
    Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
    Reserve your seat today!
  3. Paulo
    Paulo avatar
    12 posts
    Member since:
    Jun 2013

    Posted 11 Jul 2013 Link to this post

    Hi Ivaylo,

    I did what you have recommended, increased HandleTimeout and the Initialization Time, but but the issue still continues.
    I've also enabled the UseStepWaitOnElements at the same time that increased the timeouts, and with default timeouts, but with no success.


    The only solution that hands that dialog window, is that workaround that I've made.
  4. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 16 Jul 2013 Link to this post

    Hello Paulo,

    In order to investigate this further we will need a sample test reproducing this behavior. Is it possible for you to provide us with a sample test which we can execute locally and investigate further? 
    Another approach will be if you try to download our Test Studio R1 beta release, install it on a separate machine and check if the recorded step is working fine. Please note that since this is a beta version I strongly recommend you not to use it production. The beta will not require licensing so installing it on a different machine will not be a problem. If you decide to proceed that way please refer to the download link provided in my signature.

    Thank you for your cooperation in advance.

    Regards,
    Ivaylo
    Telerik
    We've released our first-ever public Test Studio BETA! Download the BETA, install it,
    and send us your feedback! Expires mid-August!
  5. Paulo
    Paulo avatar
    12 posts
    Member since:
    Jun 2013

    Posted 17 Jul 2013 Link to this post

    Hi Ivaylo,

    I have installed Test Studio R1 beta release, but the behavior was the same that in 2012.2.1420.0 - only my workaround works.

    In attach is a sample test and a .xml data source that I'm using.
    You can't execute this test - it will not run, but you can create another one based on this to run in your environment.

    Regards,
    Paulo
  6. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 19 Jul 2013 Link to this post

    Hello Paulo,

    Thank you for providing me with the test. You are right that I am not able to run the test, but using the beta version of our R1 release I have created sample test and I was not able to reproduce this behavior, it is working as expected as you can see from this video.

    I've also attached the test I am using for your further references, you can execute it on your side since it is public available demo for OnBeforeUnload.

    Regards,
    Ivaylo
    Telerik
    We've released our first-ever public Test Studio BETA! Download the BETA, install it,
    and send us your feedback! Expires mid-August!
  7. Paulo
    Paulo avatar
    12 posts
    Member since:
    Jun 2013

    Posted 19 Jul 2013 Link to this post

     Hi Ivaylo,

    The sample test in attach ran smoothly.
    Apparently this site behaves like my testing site, so I'll keep doing some tests on my site to see if I find out why this handler isn't working.

    Thank you for your feedback.

    Regards,
    Paulo
  8. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 22 Jul 2013 Link to this post

    Hello Paulo,

    You are most welcome, yes it seems like specific issue on your side. If you manage to provide access so we can reproduce this locally we can investigate further.

    Regards,
    Ivaylo
    Telerik
    We've released our first-ever public Test Studio BETA! Download the BETA, install it,
    and send us your feedback! Expires mid-August!
Back to Top