Handling Multiple IE modal dialogs

2 posts, 0 answers
  1. Sudarshan
    Sudarshan avatar
    22 posts
    Member since:
    Feb 2013

    Posted 03 Jun 2013 Link to this post

    Hi,

    How to handle multiple modal dialogs?

    On clicking a button in a modal dialog, it opens up another modal dialog.

     I'm not able to handle the new dialog that appears on clicking a button in the existing modal dialog. It's not connecting to the new modal dialog.


    Thanks
    Sudarshan






  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 04 Jun 2013 Link to this post

    Hello Sudarshan,

    You can handle the second dialog in absolutely the same way as the first one. Here is a sample code:

    AlertDialog alertDialog = AlertDialog.CreateAlertDialog(browser, DialogButton.OK);
    browser.Manager.DialogMonitor.AddDialog(alertDialog);
    browser.Manager.DialogMonitor.Start();
      
    //Trigger the dialog
    browser.Actions.Click(some element);
    alertDialog.WaitUntilHandled();
     
    browser.WaitUntilReady();
    browser.RefreshDomTree();
      
    AlertDialog alertDialog2 = AlertDialog.CreateAlertDialog(browser, DialogButton.OK);
    browser.Manager.DialogMonitor.AddDialog(alertDialog2);
    browser.Manager.DialogMonitor.Start();
      
    //Trigger the dialog
    browser.Actions.Click(some element);
      
    alertDialog2.WaitUntilHandled();

    Make sure the DOM is refreshed after handling the first dialog.

    Hope this helps.

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