コード例 #1
0
        public void ReopenWithUrlAndLogonDialogHandlerInNewProcess()
        {
            FailIfIEWindowExists("main", "ReopenWithUrlAndLogonDialogHandler");

            var logon = new LogonDialogHandler("y", "z");

            using (var ie1 = new IE())
            {
                using (var ie2 = new IE())
                {
                    Assert.AreEqual(ie1.ProcessID, ie2.ProcessID, "process id problem");

                    Assert.AreEqual("about:blank", ie2.Url);
                    var oldIEObj = ie2.InternetExplorer;

                    ie2.Reopen(MainURI, logon, true);
                    Assert.AreNotSame(oldIEObj, ie2.InternetExplorer, "Reopen should create a new browser.");

                    Assert.AreNotEqual(ie1.ProcessID, ie2.ProcessID, "process id problem");

                    Assert.AreEqual(MainURI, new Uri(ie2.Url));
                    Assert.IsTrue(ie2.DialogWatcher.Contains(logon));
                    Assert.AreEqual(1, ie2.DialogWatcher.Count);
                }
            }

            Assert.IsFalse(IsIEWindowOpen("main"), "Internet Explorer should be closed by IE.Dispose");
        }
コード例 #2
0
 public void LogonDialogTest()
 {
     using (var ie = new IE())
     {
         var logonDialogHandler = new LogonDialogHandler("test", "this");
         using (new UseDialogOnce(ie.DialogWatcher, logonDialogHandler))
         {
             ie.GoTo("http://irisresearch.library.cornell.edu/control/authBasic/authTest");
         }
         ie.WaitUntilContainsText("Basic Authentication test passed successfully", 5);
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: aminaarjoun/src
        static void Main(string[] args)
        {
            IE ie = new IE("http://192.168.0.1/pppoestatus.htm");
            LogonDialogHandler dhdlLogon = new LogonDialogHandler("admin", "password");

            ie.AddDialogHandler(dhdlLogon);
            ie.GoTo("http://192.168.0.1/pppoestatus.htm");
            Console.WriteLine("Desconecto...");
            ie.Button(Find.ByValue(" Disconnect ")).Click();
            Thread.Sleep(10000);
            //ie.GoTo("http://192.168.0.1/pppoestatus.htm");
            Console.WriteLine("Conecto...");
            ie.Button(Find.ByValue(" Connect ")).Click();
            ie.Dispose();
        }
コード例 #4
0
        public void NewIEWithUrlAndLogonDialogHandler()
        {
            FailIfIEWindowExists("main", "NewIEWithUrlAndLogonDialogHandler");

            var url   = MainURI.AbsoluteUri;
            var logon = new LogonDialogHandler("y", "z");

            using (var ie = new IE(url, logon))
            {
                Assert.AreEqual(MainURI, new Uri(ie.Url));
                Assert.IsTrue(ie.DialogWatcher.Contains(logon));
                Assert.AreEqual(1, ie.DialogWatcher.Count);

                using (var ie1 = new IE(url, logon))
                {
                    Assert.AreEqual(MainURI, new Uri(ie1.Url));
                    Assert.IsTrue(ie.DialogWatcher.Contains(logon));
                    Assert.AreEqual(1, ie.DialogWatcher.Count);
                }
            }

            Assert.IsFalse(IsIEWindowOpen("main"), "Internet Explorer should be closed by IE.Dispose");
        }
コード例 #5
0
 /// <summary>
 /// Closes then reopens Internet Explorer and navigates to the given <paramref name="uri"/>.
 /// </summary>
 /// <param name="uri">The Uri to open</param>
 /// <param name="logonDialogHandler">A <see cref="LogonDialogHandler"/> class instanciated with the logon credentials.</param>
 /// <param name="createInNewProcess">if set to <c>true</c> the IE instance is created in a new process.</param>
 /// <remarks>
 /// You could also use one of the overloaded methods.
 /// </remarks>
 /// <example>
 /// The following example creates a new Internet Explorer instances and navigates to
 /// the WatiN Project website on SourceForge leaving the created Internet Explorer open.
 /// <code>
 /// using WatiN.Core;
 ///
 /// namespace NewIEExample
 /// {
 ///    public class WatiNWebsite
 ///    {
 ///      public WatiNWebsite()
 ///      {
 ///        LogonDialogHandler logon = new LogonDialogHandler("username", "password");
 ///        IE ie = new IE(new Uri("http://watin.sourceforge.net"), logon);
 ///        ie.Reopen();
 ///      }
 ///    }
 ///  }
 /// </code>
 /// </example>
 public void Reopen(Uri uri, LogonDialogHandler logonDialogHandler, bool createInNewProcess)
 {
     Close();
     Recycle();
     CreateNewIEAndGoToUri(uri, logonDialogHandler, createInNewProcess);
 }
コード例 #6
0
 /// <summary>
 /// Opens a new Internet Explorer and navigates to the given <paramref name="uri"/>.
 /// </summary>
 /// <param name="uri">The Uri to open</param>
 /// <param name="logonDialogHandler">A <see cref="LogonDialogHandler"/> class instanciated with the logon credentials.</param>
 /// <param name="createInNewProcess">if set to <c>true</c> the IE instance is created in a new process.</param>
 /// <remarks>
 /// You could also use one of the overloaded constructors.
 /// </remarks>
 /// <example>
 /// The following example creates a new Internet Explorer instances and navigates to
 /// the WatiN Project website on SourceForge leaving the created Internet Explorer open.
 /// <code>
 /// using WatiN.Core;
 ///
 /// namespace NewIEExample
 /// {
 ///    public class WatiNWebsite
 ///    {
 ///      public WatiNWebsite()
 ///      {
 ///        LogonDialogHandler logon = new LogonDialogHandler("username", "password");
 ///        IE ie = new IE(new Uri("http://watin.sourceforge.net"), logon);
 ///      }
 ///    }
 ///  }
 /// </code>
 /// </example>
 public IE(Uri uri, LogonDialogHandler logonDialogHandler, bool createInNewProcess)
 {
     CreateNewIEAndGoToUri(uri, logonDialogHandler, createInNewProcess);
 }
コード例 #7
0
 /// <summary>
 /// Opens a new Internet Explorer and navigates to the given <paramref name="uri"/>.
 /// </summary>
 /// <param name="uri">The Uri to open</param>
 /// <param name="logonDialogHandler">A <see cref="LogonDialogHandler"/> class instanciated with the logon credentials.</param>
 /// <remarks>
 /// You could also use one of the overloaded constructors.
 /// </remarks>
 /// <example>
 /// The following example creates a new Internet Explorer instances and navigates to
 /// the WatiN Project website on SourceForge leaving the created Internet Explorer open.
 /// <code>
 /// using WatiN.Core;
 ///
 /// namespace NewIEExample
 /// {
 ///    public class WatiNWebsite
 ///    {
 ///      public WatiNWebsite()
 ///      {
 ///        LogonDialogHandler logon = new LogonDialogHandler("username", "password");
 ///        IE ie = new IE(new Uri("http://watin.sourceforge.net"), logon);
 ///      }
 ///    }
 ///  }
 /// </code>
 /// </example>
 public IE(Uri uri, LogonDialogHandler logonDialogHandler)
 {
     CreateNewIEAndGoToUri(uri, logonDialogHandler, false);
 }
コード例 #8
0
 /// <summary>
 /// Opens a new Internet Explorer and navigates to the given <paramref name="url"/>.
 /// </summary>
 /// <param name="url">The Url to open</param>
 /// <param name="logonDialogHandler">A <see cref="LogonDialogHandler"/> class instanciated with the logon credentials.</param>
 /// <param name="createInNewProcess">if set to <c>true</c> the IE instance is created in a new process.</param>
 /// <remarks>
 /// You could also use one of the overloaded constructors.
 /// </remarks>
 /// <example>
 /// The following example creates a new Internet Explorer instances and navigates to
 /// the WatiN Project website on SourceForge leaving the created Internet Explorer open.
 /// <code>
 /// using WatiN.Core;
 ///
 /// namespace NewIEExample
 /// {
 ///    public class WatiNWebsite
 ///    {
 ///      public WatiNWebsite()
 ///      {
 ///        LogonDialogHandler logon = new LogonDialogHandler("username", "password");
 ///        IE ie = new IE("http://watin.sourceforge.net", logon);
 ///      }
 ///    }
 ///  }
 /// </code>
 /// </example>
 public IE(string url, LogonDialogHandler logonDialogHandler, bool createInNewProcess)
 {
     CreateNewIEAndGoToUri(UtilityClass.CreateUri(url), logonDialogHandler, createInNewProcess);
 }
コード例 #9
0
 /// <summary>
 /// Opens a new Internet Explorer and navigates to the given <paramref name="url"/>.
 /// </summary>
 /// <param name="url">The Url to open</param>
 /// <param name="logonDialogHandler">A <see cref="LogonDialogHandler"/> class instanciated with the logon credentials.</param>
 /// <remarks>
 /// You could also use one of the overloaded constructors.
 /// </remarks>
 /// <example>
 /// The following example creates a new Internet Explorer instances and navigates to
 /// the WatiN Project website on SourceForge leaving the created Internet Explorer open.
 /// <code>
 /// using WatiN.Core;
 ///
 /// namespace NewIEExample
 /// {
 ///    public class WatiNWebsite
 ///    {
 ///      public WatiNWebsite()
 ///      {
 ///        LogonDialogHandler logon = new LogonDialogHandler("username", "password");
 ///        IE ie = new IE("http://watin.sourceforge.net", logon);
 ///      }
 ///    }
 ///  }
 /// </code>
 /// </example>
 public IE(string url, LogonDialogHandler logonDialogHandler)
 {
     CreateNewIEAndGoToUri(UtilityClass.CreateUri(url), logonDialogHandler, false);
 }