public void WhenOnBeforeUnloadReturnJavaDialogIsShown_ClickingOnCancelShouldKeepIEOpen()
        {
            using (var ie = new IE(OnBeforeUnloadJavaDialogURI))
            {
                var returnDialogHandler = new ReturnDialogHandler();
                ie.AddDialogHandler(returnDialogHandler);

                var hWnd = ie.hWnd;

                // can't use ie.Close() here cause this will cleanup the registered
                // returnDialogHandler which leads to a timeout on the WaitUntilExists
                var internetExplorer = (IWebBrowser2)ie.InternetExplorer;
                internetExplorer.Quit();

                returnDialogHandler.WaitUntilExists();
                returnDialogHandler.CancelButton.Click();

                Thread.Sleep(2000);
                Assert.IsTrue(Browser.Exists<IE>(new AttributeConstraint("hwnd", hWnd.ToString())));

                // finally close the ie instance
                internetExplorer.Quit();
                returnDialogHandler.WaitUntilExists();
                returnDialogHandler.OKButton.Click();
            }
        }
示例#2
0
        public void WhenOnBeforeUnloadReturnJavaDialogIsShown_ClickingOnCancelShouldKeepIEOpen()
        {
            using (var ie = new IE(OnBeforeUnloadJavaDialogURI))
            {
                var returnDialogHandler = ReturnDialogHandler.CreateInstance();
                ie.AddDialogHandler(returnDialogHandler);

                var hWnd = ie.hWnd;

                // can't use ie.Close() here cause this will cleanup the registered
                // returnDialogHandler which leads to a timeout on the WaitUntilExists
                var internetExplorer = (IWebBrowser2)ie.InternetExplorer;
                internetExplorer.Quit();

                returnDialogHandler.WaitUntilExists();
                returnDialogHandler.CancelButton.Click();

                Thread.Sleep(2000);
                Assert.IsTrue(Browser.Exists <IE>(new AttributeConstraint("hwnd", hWnd.ToString())));

                // finally close the ie instance
                internetExplorer.Quit();
                returnDialogHandler.WaitUntilExists();
                returnDialogHandler.OKButton.Click();

                Thread.Sleep(2000);
                Assert.IsFalse(Browser.Exists <IE>(new AttributeConstraint("hwnd", hWnd.ToString())));
            }
        }
        public void TestMultipleIE()
        {
            using (var ie = new IE(TestEventsURI))
            {
                var handler = new ConfirmDialogHandler();
                try
                {
                    ie.AddDialogHandler(handler);
                    ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
                    handler.WaitUntilExists(5);
                    handler.OKButton.Click();
                }
                finally
                {
                    ie.RemoveDialogHandler(handler);
                }

                using (var ie2 = new IE(TestEventsURI))
                {
                    var handler2 = new ConfirmDialogHandler();
                    try
                    {
                        ie2.AddDialogHandler(handler2);
                        ie2.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
                        handler2.WaitUntilExists(5);
                        handler2.OKButton.Click();
                    }
                    finally
                    {
                        ie2.RemoveDialogHandler(handler2);
                    }
                }
            }
        }
        public void DownloadRun()
        {
            var dhdl = new FileDownloadHandler(FileDownloadOptionEnum.Run);
            var ie = new IE();
            ie.AddDialogHandler(dhdl);
            ie.WaitForComplete();
            ie.GoTo("http://watin.sourceforge.net/WatiN-1.0.0.4000-net-1.1.msi");

            dhdl.WaitUntilFileDownloadDialogIsHandled(5);
            dhdl.WaitUntilDownloadCompleted(20);
            ie.Close();
        }
示例#5
0
        public void DownloadRun()
        {
            var dhdl = new FileDownloadHandler(FileDownloadOptionEnum.Run);
            var ie   = new IE();

            ie.AddDialogHandler(dhdl);
            ie.WaitForComplete();
            ie.GoTo("http://watin.sourceforge.net/WatiN-1.0.0.4000-net-1.1.msi");

            dhdl.WaitUntilFileDownloadDialogIsHandled(5);
            dhdl.WaitUntilDownloadCompleted(20);
            ie.Close();
        }
        public void DownloadOpen()
        {
            var dhdl = new FileDownloadHandler(FileDownloadOptionEnum.Open);

            var ie = new IE();
            ie.AddDialogHandler(dhdl);
            ie.WaitForComplete();
            ie.GoTo("http://watin.sourceforge.net/WatiNRecorder.zip");

            dhdl.WaitUntilFileDownloadDialogIsHandled(5);
            dhdl.WaitUntilDownloadCompleted(20);
            ie.Close();
        }
示例#7
0
        public void DownloadOpen()
        {
            var dhdl = new FileDownloadHandler(FileDownloadOptionEnum.Open);

            var ie = new IE();

            ie.AddDialogHandler(dhdl);
            ie.WaitForComplete();
            ie.GoTo("http://watin.sourceforge.net/WatiNRecorder.zip");

            dhdl.WaitUntilFileDownloadDialogIsHandled(5);
            dhdl.WaitUntilDownloadCompleted(20);
            ie.Close();
        }
示例#8
0
        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();
        }
        public void DownloadSave()
        {
            var file = new FileInfo(@"c:\temp\test.zip");
            file.Directory.Create();
            file.Delete();
            Assert.That(file.Exists, Is.False, file.FullName + " file should not exist before download");

            var fileDownloadHandler = new FileDownloadHandler(file.FullName);

            using (var ie = new IE())
            {
                ie.AddDialogHandler(fileDownloadHandler);

            //				ie.GoTo("http://watin.sourceforge.net/WatiN-1.0.0.4000-net-1.1.msi");
                        ie.GoTo("http://watin.sourceforge.net/WatiNRecorder.zip");

                fileDownloadHandler.WaitUntilFileDownloadDialogIsHandled(15);
                fileDownloadHandler.WaitUntilDownloadCompleted(200);
            }

            file = new FileInfo(@"c:\temp\test.zip");
            Assert.IsTrue(file.Exists, file.FullName + " file does not exist after download");
        }
示例#10
0
        [Test]         // Ignore("Because of timeout issues, run this test manually and not automated"), Category("InternetConnectionNeeded")]
        public void DownloadSave()
        {
            var file = new FileInfo(@"c:\temp\test.zip");

            file.Directory.Create();
            file.Delete();
            Assert.That(file.Exists, Is.False, file.FullName + " file should not exist before download");

            var fileDownloadHandler = new FileDownloadHandler(file.FullName);

            using (var ie = new IE())
            {
                ie.AddDialogHandler(fileDownloadHandler);

//				ie.GoTo("http://watin.sourceforge.net/WatiN-1.0.0.4000-net-1.1.msi");
                ie.GoTo("http://watin.sourceforge.net/WatiNRecorder.zip");

                fileDownloadHandler.WaitUntilFileDownloadDialogIsHandled(15);
                fileDownloadHandler.WaitUntilDownloadCompleted(200);
            }

            file = new FileInfo(@"c:\temp\test.zip");
            Assert.IsTrue(file.Exists, file.FullName + " file does not exist after download");
        }
        public void TestMultipleIE()
        {
            using (var ie = new IE(TestEventsURI))
            {
                var handler = new ConfirmDialogHandler();
                try
                {
                    ie.AddDialogHandler(handler);
                    ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
                    handler.WaitUntilExists(5);
                    handler.OKButton.Click();
                }
                finally
                {
                    ie.RemoveDialogHandler(handler);
                }

                using (var ie2 = new IE(TestEventsURI))
                {
                    var handler2 = new ConfirmDialogHandler();
                    try
                    {
                        ie2.AddDialogHandler(handler2);
                        ie2.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
                        handler2.WaitUntilExists(5);
                        handler2.OKButton.Click();
                    }
                    finally
                    {
                        ie2.RemoveDialogHandler(handler2);
                    }
                }
            }
        }