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);
			}
		}
예제 #2
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);
		}
예제 #3
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);
		}
예제 #4
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);
		}
예제 #5
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);
		}
예제 #6
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);
		}
예제 #7
0
파일: IETests.cs 프로젝트: koshdim/KoWatIn
        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");
        }
예제 #8
0
파일: IETests.cs 프로젝트: koshdim/KoWatIn
        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");
        }
예제 #9
0
파일: IE.cs 프로젝트: pusp/o2platform
		private void CreateNewIEAndGoToUri(Uri uri, LogonDialogHandler logonDialogHandler, bool createInNewProcess)
		{
			CheckThreadApartmentStateIsSTA();

			MoveMousePoinerToTopLeft();

			if (createInNewProcess)
			{
				Logger.LogAction("Creating IE instance in a new process");
				InitIEAndStartDialogWatcher(CreateIEInNewProcess(), uri);
			}
			else
			{
				Logger.LogAction("Creating IE instance");
				InitIEAndStartDialogWatcher(new InternetExplorerClass(), uri);
			}

			if (logonDialogHandler != null)
			{
				// remove other logon dialog handlers since only one handler
				// can effectively handle the logon dialog.
				DialogWatcher.RemoveAll(new LogonDialogHandler("a", "b"));

				// Add the (new) logonHandler
				DialogWatcher.Add(logonDialogHandler);
			}

			WaitForComplete();
		}