当前位置: 首页>>代码示例>>C#>>正文


C# IE.AddDialogHandler方法代码示例

本文整理汇总了C#中IE.AddDialogHandler方法的典型用法代码示例。如果您正苦于以下问题:C# IE.AddDialogHandler方法的具体用法?C# IE.AddDialogHandler怎么用?C# IE.AddDialogHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IE的用法示例。


在下文中一共展示了IE.AddDialogHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WhenOnBeforeUnloadReturnJavaDialogIsShown_ClickingOnCancelShouldKeepIEOpen

        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();
            }
        }
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:26,代码来源:ReturnJavaDialogHandlerTest.cs

示例2: DownloadRun

        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();
        }
开发者ID:fschwiet,项目名称:watin_unbranched,代码行数:12,代码来源:FileDownloadHandlerTests.cs

示例3: DownloadOpen

        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();
        }
开发者ID:fschwiet,项目名称:watin_unbranched,代码行数:13,代码来源:FileDownloadHandlerTests.cs

示例4: DownloadSave

        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");
        }
开发者ID:fschwiet,项目名称:watin_unbranched,代码行数:23,代码来源:FileDownloadHandlerTests.cs

示例5: TestMultipleIE

        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);
                    }
                }
            }
        }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:34,代码来源:ConfirmDialogHandlerTests.cs


注:本文中的IE.AddDialogHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。