Javascript message box handling

18 posts, 1 answers
  1. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 13 Jul 2011 Link to this post

    I have been trying to get some unit tests (VS2010) to work that deal with confirm message boxes.  In short, I have two tests that use the MouseClick() function to click a button that brings up a message box in IE8.  I found code on-line regarding using the Manager.Current.DialogManager.AddDialog method.  In my first test I call an inactivate button and an activate button, both call the confirm and the test works.  In the second test, I call a delete button which calls a confirm message box, and this is where I am having issues.  If I run both tests individually, using VS2010, my code works.  If I run both tests together, the first test works (with the inactivate and activate buttons) but the second test (with the delete button) does not work.  The code errors out on the confirmDialog.WaitUntilHandled(); method.

    Basic code I am using is as follows:

     

     

    ConfirmDialog confirmDialog = ConfirmDialog.CreateConfirmDialog(Manager.Current.ActiveBrowser, DialogButton.OK);

     

    confirmDialog.HandlerDelegate = new DialogHandlerDelegate(this.ConfirmHandleDialog);

    Manager.Current.DialogMonitor.AddDialog(confirmDialog);

    Manager.Current.DialogMonitor.Start();

     

    // Click the button

    this.Action.MouseClickItem(RSSControls.Applications.ApplicationsEditLoginPage.DeleteQuestion);

    confirmDialog.WaitUntilHandled();

     

    Manager.Current.DialogMonitor.RemoveDialog(confirmDialog);

    Manager.Current.DialogMonitor.Stop();

     

     

    private void ConfirmHandleDialog(IDialog dialog)

    {

    ArtOfTest.WebAii.Win32.Button b = new ArtOfTest.WebAii.Win32.Button(dialog.Window, "OK", false);

     b.Click();

    dialog.HandleCount = 1;

     Manager.Current.DialogMonitor.RemoveDialog(dialog);

    }

    Am I doing something incorrect?  The tests work correctly when I run them individually but when I run them together the second test does not work.  The message box confirmation box pops up, but it never gets handled.  I have looked all over the internet and found several examples of how to use this feature, however I am still having problems.

    Also, does this function work in IE7?  It appears to not work at all when I test my tests against an IE7 machine.

  2. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 14 Jul 2011 Link to this post

    I was able to reproduce this using the IEDownloadDialog control as well.

    Have one test that opens a link to a PDF file and was able to use code to click the Open button.

    The test opens two PDF file links successfully.

    Copy the test and rename it, then run that test individually and it works.  But when I run both tests together, the first test works, but the second test fails waiting for the download dialog box to be handled.

    Sample code:

      /// <summary>
      /// Opens 2 PDF link.
      /// </summary>
      [TestMethod()]
      [TestProperty("TestCasePurpose", "Opens two PDF links.")]
      [TestCategory("InternetExplorer")]
      [TestCategory("TSS")]
      [TestCategory("Admin Tab")]
      public void TSS_TelerikSample1()
      {
       TestRunSettings testRunSettings = new TestRunSettings(BrowserType.InternetExplorer, CommonData.LoggingDirectory + "TSSTest", this.applicationName, this.TestContextInstance.TestName, CommonData.TSSAppLoginName, CommonData.TSSAppLoginPassword);
       TestResults testMethod = this.Action.TestCaseBegin(testRunSettings.TestName, testRunSettings.TestName, this.TestContextInstance.Properties["TestCasePurpose"].ToString());
       Manager manager = this.Action.TestInitialize(testRunSettings);

       // Login.
       this.Action.TSSLogin(testRunSettings.LoginName, testRunSettings.LoginPassword);
       Thread.Sleep(3000);

       this.Action.ClickItem(TSSControls.Navigation.Admin);
       this.Action.ClickItem(TSSControls.AdminSection.GeneralSettings.ManageAgencyComplianceSettings);

       IEDownloadDialog downloadDialog = new IEDownloadDialog(Manager.Current.ActiveBrowser, DialogButton.OPEN, new Desktop());
       Manager.Current.DialogMonitor.AddDialog(downloadDialog);
       Manager.Current.DialogMonitor.Start();

       // Click the link
       this.Action.ClickItem(TSSControls.AdminSection.GeneralSettings.ManageAgencyComplianceSettingsSection.ComplianceSetupSection.ComplianceSetupChecklist);

       // This line of code will time out and fail when running both Telerik Tests, and this is the second test that is executed.
       downloadDialog.WaitUntilHandled();

       Manager.Current.DialogMonitor.RemoveDialog(downloadDialog);
       Manager.Current.DialogMonitor.Stop();

       // Close the PDF window what is opened by clicking the link.
       Process[] processes = Process.GetProcessesByName("acrord32");

       int loopCt = 0;
       foreach (Process item in processes)
       {
        string processName = "Admin_Compliance_Setup_Checklist";

        if (item.MainWindowTitle.ToString().ToUpper().Contains(processName.ToUpper()))
        {
         Manager.Current.ConnectToApplication(item);
         Manager.Current.Applications[loopCt].Quit();
        }

        loopCt++;
       }

       this.Action.ClickItem(TSSControls.Navigation.Admin);
       this.Action.ClickItem(TSSControls.AdminSection.GeneralSettings.ManageAgencyComplianceSettings);

       downloadDialog = new IEDownloadDialog(Manager.Current.ActiveBrowser, DialogButton.OPEN, new Desktop());
       Manager.Current.DialogMonitor.AddDialog(downloadDialog);
       Manager.Current.DialogMonitor.Start();

       // Click the link
       this.Action.ClickItem(TSSControls.AdminSection.GeneralSettings.ManageAgencyComplianceSettingsSection.ComplianceSetupSection.CredentialSetup);
       downloadDialog.WaitUntilHandled();

       Manager.Current.DialogMonitor.RemoveDialog(downloadDialog);
       Manager.Current.DialogMonitor.Stop();

       // Close the PDF window what is opened by clicking the link.
       processes = Process.GetProcessesByName("acrord32");

       loopCt = 0;
       foreach (Process item in processes)
       {
        string processName = "Admin_Credential_Setup";

        if (item.MainWindowTitle.ToString().ToUpper().Contains(processName.ToUpper()))
        {
         Manager.Current.ConnectToApplication(item);
         Manager.Current.Applications[loopCt].Quit();
        }

        loopCt++;
       }

       // Log Out of TSS.
       this.Action.ClickItem(TSSControls.Headers.LogOut, true);
       Thread.Sleep(1000);

       this.Action.TestCaseEnd(testMethod);
      }

      /// <summary>
      /// Opens PDF link.
      /// </summary>
      [TestMethod()]
      [TestProperty("TestCasePurpose", "Opens a PDF link, same link as TelerikSample1 test.")]
      [TestCategory("InternetExplorer")]
      [TestCategory("TSS")]
      [TestCategory("Admin Tab")]
      public void TSS_TelerikSample2()
      {
       TestRunSettings testRunSettings = new TestRunSettings(BrowserType.InternetExplorer, CommonData.LoggingDirectory + "TSSTest", this.applicationName, this.TestContextInstance.TestName, CommonData.TSSAppLoginName, CommonData.TSSAppLoginPassword);
       TestResults testMethod = this.Action.TestCaseBegin(testRunSettings.TestName, testRunSettings.TestName, this.TestContextInstance.Properties["TestCasePurpose"].ToString());
       Manager manager = this.Action.TestInitialize(testRunSettings);

       // Login.
       this.Action.TSSLogin(testRunSettings.LoginName, testRunSettings.LoginPassword);
       Thread.Sleep(3000);

       this.Action.ClickItem(TSSControls.Navigation.Admin);
       this.Action.ClickItem(TSSControls.AdminSection.GeneralSettings.ManageAgencyComplianceSettings);

       IEDownloadDialog downloadDialog = new IEDownloadDialog(Manager.Current.ActiveBrowser, DialogButton.OPEN, new Desktop());
       Manager.Current.DialogMonitor.AddDialog(downloadDialog);
       Manager.Current.DialogMonitor.Start();

       // Click the link
       this.Action.ClickItem(TSSControls.AdminSection.GeneralSettings.ManageAgencyComplianceSettingsSection.ComplianceSetupSection.ComplianceSetupChecklist);
       
       // This line of code will time out and fail when running both Telerik Tests, and this is the second test that is executed.
       downloadDialog.WaitUntilHandled();

       Manager.Current.DialogMonitor.RemoveDialog(downloadDialog);
       Manager.Current.DialogMonitor.Stop();

       // Close the PDF window what is opened by clicking the link.
       Process[] processes = Process.GetProcessesByName("acrord32");

       int loopCt = 0;
       foreach (Process item in processes)
       {
        string processName = "Admin_Compliance_Setup_Checklist";

        if (item.MainWindowTitle.ToString().ToUpper().Contains(processName.ToUpper()))
        {
         Manager.Current.ConnectToApplication(item);
         Manager.Current.Applications[loopCt].Quit();
        }

        loopCt++;
       }

       // Log Out of TSS.
       this.Action.ClickItem(TSSControls.Headers.LogOut, true);
       Thread.Sleep(1000);

       this.Action.TestCaseEnd(testMethod);
      }

  3. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 18 Jul 2011 Link to this post

    Hi Jamie,

    I am unable to compile your sample code. There are many undefined references including:

    TestRunSettings
    TestResults
    CommonData
    TestContextInstance
    this.applicationName
    this.Action
    TSSControls

    If you can supply me definitions for these objects I'd be happy to continue investigating this report.

    Regards,
    Cody
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  4. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 18 Jul 2011 Link to this post

    Try this, this is more generic code.

      /// <summary>
      /// Opens 2 PDF link.
      /// </summary>
      [TestMethod()]
      [TestProperty("TestCasePurpose", "Opens two PDF links.")]
      [TestCategory("InternetExplorer")]
      [TestCategory("Telerik")]
      public void TelerikSample1()
      {
       Settings.WebSettings webSettings = new Settings.WebSettings(BrowserType.InternetExplorer);
       Settings settings = new Settings(webSettings);
       settings.Web.EnableSilverlight = true;
       Manager manager = new Manager(settings);
       manager.Start();
       manager.LaunchNewBrowser();
       AlertDialog a = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
       Manager.Current.DialogMonitor.AddDialog(a);
       Manager.Current.DialogMonitor.Start();

       // The active browser 
       Manager.Current.ActiveBrowser.NavigateTo("http://www.javascripter.net/faq/confirm.htm");

       // Click the button 
       Manager.Current.ActiveBrowser.Find.ByAttributes<HtmlInputButton>(new string[1] { "value=Try it now" }).MouseClick();
       a.WaitUntilHandled();

       Manager.Current.DialogMonitor.RemoveDialog(a);
       Manager.Current.DialogMonitor.Stop();   
      }

      /// <summary>
      /// Opens PDF link.
      /// </summary>
      [TestMethod()]
      [TestProperty("TestCasePurpose", "Opens a PDF link, same link as TelerikSample1 test.")]
      [TestCategory("InternetExplorer")]
      [TestCategory("Telerik")]
      public void TelerikSample2()
      {
       Settings.WebSettings webSettings = new Settings.WebSettings(BrowserType.InternetExplorer);
       Settings settings = new Settings(webSettings);
       settings.Web.EnableSilverlight = true;
       Manager manager = new Manager(settings);
       manager.Start();
       manager.LaunchNewBrowser();
       AlertDialog a = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
       Manager.Current.DialogMonitor.AddDialog(a);
       Manager.Current.DialogMonitor.Start();

       // The active browser 
       Manager.Current.ActiveBrowser.NavigateTo("http://www.javascripter.net/faq/confirm.htm");

       // Click the button 
       Manager.Current.ActiveBrowser.Find.ByAttributes<HtmlInputButton>(new string[1] { "value=Try it now" }).MouseClick();
       a.WaitUntilHandled();

       Manager.Current.DialogMonitor.RemoveDialog(a);
       Manager.Current.DialogMonitor.Stop();
      }

  5. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 18 Jul 2011 Link to this post

    Hi Jamie,

    Thank you for the updated code. One problem I found in your code is that it wasn't handling the second Alert window. I updated the code to this:

    Settings.WebSettings webSettings = new Settings.WebSettings(BrowserType.InternetExplorer);
    Settings settings = new Settings(webSettings);
    settings.Web.EnableSilverlight = true;
    Manager manager = new Manager(settings);
    Manager.Start();
    Manager.LaunchNewBrowser();
    AlertDialog a1 = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
    AlertDialog a2 = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
    Manager.DialogMonitor.AddDialog(a1);
    Manager.DialogMonitor.AddDialog(a2);
    Manager.DialogMonitor.Start();
    // The active browser
    Manager.ActiveBrowser.NavigateTo("http://www.javascripter.net/faq/confirm.htm");
    // Click the button
    Manager.ActiveBrowser.Find.ByExpression<HtmlInputButton>(new HtmlFindExpression("value=Try it now")).Click();
    a1.WaitUntilHandled();
    a2.WaitUntilHandled();
    Manager.Current.DialogMonitor.RemoveDialog(a1);
    Manager.Current.DialogMonitor.RemoveDialog(a2);
    Manager.DialogMonitor.Stop();

    Next what are you using for your test setup and tear down i.e. your [TestInitialize()]
    [TestCleanup()] and [ClassCleanup()] sections? If I put your code in with our standard skeleton for test setup and teardown the problem I ran into is that the browser was being left open after the test completed. This can cause any follow on tests to fail. The reason for the problem is that you're using your own Manager object (duplicating the Manager object contained in our skeleton) and not calling the BaseTest.Shutdown call which is needed for test cleanup.

    Regards,
    Cody
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  6. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 19 Jul 2011 Link to this post

    I changed the web site so you do not get the two message boxes.  And I have included the initializer and clean up.
    My problem is that these two samples work when running them together in Visual Studio 2010.  But when I run my tests, which are a little more complicated, the first test with an alert dialog works, but any test after that that needs to handle a confirm or alert dialog hangs on the alertDialog.WaitUntilHandled(); code line, and then the test fails because it times out.  My code seems to be configured the same way as these examples, and when I run the tests one at a time, they work indiviudally, but not when trying to run them all at once.  When running them all at once, the first one seems to work, but anything after hangs on that code line.

      /// <summary>
      /// Default Class Cleanup.
      /// </summary>
      [ClassCleanup()]
      public static void MyClassCleanup()
      {
      }

      /// <summary>
      /// Default Test Initializer.
      /// </summary>
      [TestInitialize()]
      public void MyTestInitialize()
      {
      }

      /// <summary>
      /// Default Test Cleanup.
      /// </summary>
      [TestCleanup()]
      public void MyTestCleanup()
      {
       try
       {
        Manager.Current.ActiveBrowser.Close();
       }
       catch
       {
       }

       try
       {
        Manager.Current.Log.Dispose();
       }
       catch
       {
       }

       this.CleanUp();
      }

      /// <summary>
      /// Telerik Sample 1.
      /// </summary>
      [TestMethod()]
      [TestCategory("InternetExplorer")]
      [TestCategory("Telerik")]
      public void TelerikSample1()
      {
       Settings.WebSettings webSettings = new Settings.WebSettings(BrowserType.InternetExplorer);
       Settings settings = new Settings(webSettings);
       settings.Web.EnableSilverlight = true;
       Manager manager = new Manager(settings);
       manager.Start();
       manager.LaunchNewBrowser();
       AlertDialog alertDialog = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
       Manager.Current.DialogMonitor.AddDialog(alertDialog);
       Manager.Current.DialogMonitor.Start();

       // The active browser 
       Manager.Current.ActiveBrowser.NavigateTo("http://www.javascripter.net/faq/alert.htm");

       // Click the button 
       Manager.Current.ActiveBrowser.Find.ByAttributes<HtmlInputButton>(new string[1] { "value=Try it now" }).MouseClick();
       alertDialog.WaitUntilHandled();

       Manager.Current.DialogMonitor.RemoveDialog(alertDialog);
       Manager.Current.DialogMonitor.Stop();

       Manager.Current.ActiveBrowser.Close();
       manager.Dispose();
      }

      /// <summary>
      /// Telerik Sample 2.
      /// </summary>
      [TestMethod()]
      [TestCategory("InternetExplorer")]
      [TestCategory("Telerik")]
      public void TelerikSample2()
      {
       Settings.WebSettings webSettings = new Settings.WebSettings(BrowserType.InternetExplorer);
       Settings settings = new Settings(webSettings);
       settings.Web.EnableSilverlight = true;
       Manager manager = new Manager(settings);
       manager.Start();
       manager.LaunchNewBrowser();
       AlertDialog alertDialog = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
       Manager.Current.DialogMonitor.AddDialog(alertDialog);
       Manager.Current.DialogMonitor.Start();

       // The active browser 
       Manager.Current.ActiveBrowser.NavigateTo("http://www.javascripter.net/faq/alert.htm");

       // Click the button 
       Manager.Current.ActiveBrowser.Find.ByAttributes<HtmlInputButton>(new string[1] { "value=Try it now" }).MouseClick();
       alertDialog.WaitUntilHandled();

       Manager.Current.DialogMonitor.RemoveDialog(alertDialog);
       Manager.Current.DialogMonitor.Stop();

       Manager.Current.ActiveBrowser.Close();
       manager.Dispose();
      }

  7. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 19 Jul 2011 Link to this post

    Hi Jamie,

    The problem is that you're not properly initializing and tearing down the test. Please do this instead:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;


    using ArtOfTest.WebAii.Controls.HtmlControls;
    using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
    using ArtOfTest.WebAii.Core;
    using ArtOfTest.WebAii.ObjectModel;
    using ArtOfTest.WebAii.TestAttributes;
    using ArtOfTest.WebAii.TestTemplates;
    using ArtOfTest.WebAii.Win32.Dialogs;


    using ArtOfTest.WebAii.Silverlight;
    using ArtOfTest.WebAii.Silverlight.UI;


    using Microsoft.VisualStudio.TestTools.UnitTesting;


    namespace WebAiiCodedTests
    {
        /// <summary>
        /// Summary description for TelerikDialogHandlingVSUnitTest1
        /// </summary>
        [TestClass]
        public class TelerikDialogHandlingVSUnitTest1 : BaseTest
        {
            private TestContext testContextInstance = null;
            /// <summary>
            ///Gets or sets the VS test context which provides
            ///information about and functionality for the
            ///current test run.
            ///</summary>
            public TestContext TestContext
            {
                get
                {
                    return testContextInstance;
                }
                set
                {
                    testContextInstance = value;
                }
            }


            /// <summary>
            /// Default Class Cleanup.
            /// </summary>
            [ClassCleanup()]
            public static void MyClassCleanup()
            {
                ShutDown();
            }


            /// <summary>
            /// Default Test Initializer.
            /// </summary>
            [TestInitialize()]
            public void MyTestInitialize()
            {
                Settings settings = GetSettings();


                // Override the settings you want. For example:
                settings.Web.DefaultBrowser = BrowserType.InternetExplorer;
                settings.Web.EnableSilverlight = true;


                // Now call Initialize again with your updated settings object
                Initialize(settings, new TestContextWriteLine(this.TestContext.WriteLine));
                SetTestMethod(this, (string)TestContext.Properties["TestName"]);
            }


            /// <summary>
            /// Default Test Cleanup.
            /// </summary>
            [TestCleanup()]
            public void MyTestCleanup()
            {
                this.CleanUp();
            }


            /// <summary>
            /// Telerik Sample 1.
            /// </summary>
            [TestMethod()]
            [TestCategory("InternetExplorer")]
            [TestCategory("Telerik")]
            public void TelerikSample1()
            {
                Manager.LaunchNewBrowser();
                AlertDialog alertDialog = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
                Manager.DialogMonitor.AddDialog(alertDialog);
                Manager.DialogMonitor.Start();
                // The active browser  
                Manager.ActiveBrowser.NavigateTo("http://www.javascripter.net/faq/alert.htm");
                // Click the button  
                Manager.ActiveBrowser.Find.ByAttributes<HtmlInputButton>(new string[1] { "value=Try it now" }).MouseClick();
                alertDialog.WaitUntilHandled();
                Manager.DialogMonitor.RemoveDialog(alertDialog);
                Manager.DialogMonitor.Stop();
            }


            /// <summary>
            /// Telerik Sample 2.
            /// </summary>
            [TestMethod()]
            [TestCategory("InternetExplorer")]
            [TestCategory("Telerik")]
            public void TelerikSample2()
            {
                Manager.LaunchNewBrowser();
                AlertDialog alertDialog = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
                Manager.DialogMonitor.AddDialog(alertDialog);
                Manager.DialogMonitor.Start();
                // The active browser  
                Manager.ActiveBrowser.NavigateTo("http://www.javascripter.net/faq/alert.htm");
                // Click the button  
                Manager.ActiveBrowser.Find.ByAttributes<HtmlInputButton>(new string[1] { "value=Try it now" }).MouseClick();
                alertDialog.WaitUntilHandled();
                Manager.DialogMonitor.RemoveDialog(alertDialog);
                Manager.DialogMonitor.Stop();
            }
        }
    }


    Greetings,
    Cody
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  8. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 22 Aug 2011 Link to this post

    Thanks.  Sorry it took so long to respond.  With disposing the manager properly in all cases it appears all my tests with message boxes (alerts and confirms) now work on my computer and on some of the agents.

    Basically it appears to boil down to the following, I have 1 controller and 5 agents.  1 agent is XP with IE7, 1 agent is Vista with IE7, and the last three are Windows 7 with IE 8.  If I run a simple test with a ConfirmDialog dialog on the XP or the Vista agent, the test fails because it appears the message box is closed without clicking the OK button.  However the same test works on the 3 Windows 7 agents.

    How can I get this to work on the XP and the Vista agents with IE7?  I have looked at the IE configurations and they appear to be setup as stated in other threads.

    It is very frustrating that I can flip from one agent to another agent and it works, but then I flip back and it does not work.
    I believe it has to do with the WaitUntilHandled method.

    Note, I have a custom ConfirmHandleDialog method that is set to the HandlerDelegate, but note it does not get called from IE7.  I have a ConsoleWrite in that method and it only gets called from IE8.  However on IE7 the message box is closed, it is just not hitting the OK button, just appears to be closing it.  This is my problem, please help, thanks.
  9. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 23 Aug 2011 Link to this post

    Hi Jamie,

    I suspect our Unexpected Dialog Handler is getting in your way. You can turn it off in the Settings object you pass into the call to Initialize:

    /// <summary>
    /// Default Test Initializer.
    /// </summary>
    [TestInitialize()]
    public void MyTestInitialize()
    {
        Settings settings = GetSettings();
     
        // Override the settings you want. For example:
        settings.Web.DefaultBrowser = BrowserType.InternetExplorer;
        settings.Web.EnableSilverlight = true;
        settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
     
        // Now call Initialize again with your updated settings object
        Initialize(settings, new TestContextWriteLine(this.TestContext.WriteLine));
        SetTestMethod(this, (string)TestContext.Properties["TestName"]);
    }

    Or you can disable it in the currently active settings:

    Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;

    Best wishes,
    Cody
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  10. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 23 Aug 2011 Link to this post

    I have added this already after my last post.

     

    this

     

     

    .manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;

     

     

     

    Manager.Current.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;

    And now what happens is on IE8 the test still works as is.  But on IE7 the confirmation dialog just hangs there and does not close.

    I can repeatedly duplicate this on IE7, but not on IE8.  It appears there is an issue with the Telerik Testing Framework and IE7.

    I have been playing around with trying to do different things based on the IE version but have been unable to get anything to work for IE7.  I have attached my latest code snippet of my RSS_TestDialog() method.

    If I changed it to HandleandContinue for IE7 in code, then the confirm dialog pops up and then closes, but it is not triggering the OK button.  it just closes it.

     

  11. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 23 Aug 2011 Link to this post

    Hello Jamie,

    Which version of our testing framework do you have installed? I was just reminded we had a bug in 2011.1.712 that broke dialog handing for IE7 only. It has since been fixed. If you download the latest internal build, this problem has been fixed.

    Kind regards,
    Cody
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  12. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 23 Aug 2011 Link to this post

    We are not using the latest version.  I am trying to install that now.  Does this need to be installed on both the controller and the agents?  Do the controller and agents have to be the same versions?
  13. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 23 Aug 2011 Link to this post

    Hello Jamie,

    It is critical that all machines involved be using the same version. Otherwise you will run into DLL dependency problems or incompatible API changes.

    Kind regards,
    Cody
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  14. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 23 Aug 2011 Link to this post

    I have updated my computer, the controller and the one agent I am running against and it still does not work.

    I have tried with and without setting the UnexpectedDialogAction property:

    settings.UnexpectedDialogAction =

     

    UnexpectedDialogAction.DoNotHandle

     


    I get the following error:

    Test method AgencyTestAutomation.RSSTest.RSS_TestDialog threw exception: System.TimeoutException: Timed out waiting '30000' msec. for any dialog to be handled '1'


    What else could I be missing?  The test works on my machine with IE8 but is still not working on the agent with IE7
  15. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 24 Aug 2011 Link to this post

    Okay, now that I upgraded to the latest build.  I was moving on and creating another test and now I get an error after the NavigateTo method.  IE stops working and reloads, however it renders me unable to log into my application and thus the test fails.  My previous tests I know work, fail with the same issue.  The error on my computer (Windows 7 with IE8) and thus all my tests fail when running locally is as follows (retrieved from the Event Viewer):

    (NOTE:  uninstalled the newest build and reinstalling the earlier build, corrects the issue on my computer - so what should I do?)

    Fault bucket 2259667801, type 5

    Event Name: CLR20r3

    Response: Not available

    Cab Id: 0

    Problem signature:

    P1: iexplore.exe

    P2: 8.0.7600.16839

    P3: 4e0015ef

    P4: ArtOfTest.WebAii

    P5: 2011.1.712.0

    P6: 4e1c2a41

    P7: 10ad

    P8: 26

    P9: System.ComponentModel.Win32

    P10:

    Attached files:

    C:\Users\jamie\AppData\Local\Temp\WER89B8.tmp.WERInternalMetadata.xml

    These files may be available here:

    C:\Users\jamie\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_iexplore.exe_9ba1347cbe8e2768115770226af2ea8e552381_04c88c76

    Analysis symbol:

    Rechecking for solution: 0

    Report Id: f8673ab3-ce64-11e0-981c-b8ac6f84f201

    Report Status: 0

  16. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 25 Aug 2011 Link to this post

    Hi Jamie,

    We haven't had any other customers report a similar problem. I have no idea what could be causing it. Which version did you upgrade to (was it 2011.1.817?). And, if I understand correctly, you staying 2011.1.712 works just fine? FYI, we just released 2011.1.825 today. Might be interesting to try that build as well... however I will admit I am not hopeful it will work any better.

    I'd like to look at this problem on your computer via GoToMeeting. Let me know what time zone you are in and your availability and I'll setup the meeting. I'm in Austin, TX which is Central Time (GMT -6).

    All the best,
    Cody
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  17. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 26 Aug 2011 Link to this post

    I upgraded to the 2011.1.712 version.

    No it does not work.
    I have updated my computer, the controller and the one agent I am running against, with the 2011.1.712 version, and it still does not work.  Now the test just holds the confirm dialog open.  My results with and without setting the UnexpectedDialogAction on IE7 are either the dialog does not close, or it closes but the Okay button is not pressed so the redirect is not occuring and thus the test fails.

    I have tried with and without setting the UnexpectedDialogAction property:

    settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle

    .DoNotHandle

    I get the following error:

    Test method AgencyTestAutomation.RSSTest.RSS_TestDialog threw exception: System.TimeoutException: Timed out waiting '30000' msec. for any dialog to be handled '1'

    What else could I be missing?  The test works on my machine with IE8 but is still not working on the agent with IE7

    So then while I was waiting for a response for the above issue I left the upgraded version of the testing framework on my machine, and when I was working on another test, the NavigateTo method call was failing.  What was happening was I was stepping over the NavigateTo method, waiting for like 2-3 seconds an the IE would reload cause of an error.  Thus causing my test to fail because the IE pipe was broken.  So basically I have reverted back to the 2011.1.5 version of the testing framework, and I am back to my original problem of the confirm boxes do not appear to be handled correctly on IE7 machines.

  18. Answer
    Cody
    Admin
    Cody avatar
    3354 posts

    Posted 26 Aug 2011 Link to this post

    Hello Jamie,

    Thank you for the additional information. There is a known bug in 2011.1.712 regarding dialog handling and IE7 specifically. This bug has been fixed in later builds. To overcome this problem you need to upgrade to a version later than 2011.1.712.

    Kind regards,
    Cody
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
Back to Top