• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IE类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: UseLambasSpeedTest

        public void UseLambasSpeedTest()
        {
            using (var ie = new IE(BaseWatiNTest.MainURI))
            {
                var textFieldStart = ie.TextField(t => t.Name == "TextareaName");

                const int numberOfLookUps = 500;

                StopWatch stopWatch1 = new StopWatch();
                stopWatch1.Start();

                for (var i = 0; i < numberOfLookUps; i++)
                {
                    var textField = ie.TextField(t => t.Name == "TextareaName");
                    Assert.That(textField.Exists);
                }
                stopWatch1.Stop();

                var stopWatch2 = new StopWatch();
                stopWatch2.Start();

                for (var i = 0; i < numberOfLookUps; i++)
                {
                    var textField = ie.TextField(Find.ByName("TextareaName"));
                    Assert.That(textField.Exists);
                }
                stopWatch2.Stop();

                Console.WriteLine("1: " + stopWatch1.TicksSpend / numberOfLookUps + " " + stopWatch1.TicksSpend + " " + stopWatch1.TicksSpend / 1000);
                Console.WriteLine("2: " + stopWatch1.TicksSpend / numberOfLookUps + " " + stopWatch2.TicksSpend + " " + stopWatch2.TicksSpend / 1000);
            }
        }
开发者ID:exaphaser,项目名称:WatiN,代码行数:32,代码来源:DotNet35Tests.cs


示例2: AddProtocolToUrlIfOmmitted

 public void AddProtocolToUrlIfOmmitted()
 {
     using (var ie = new IE("www.google.com"))
     {
         Assert.That(ie.Url, Text.StartsWith("http://"));
     }
 }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:7,代码来源:IETests.cs


示例3: 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


示例4: DoesFrameCodeWorkIfTwoBrowsersWithFramesAreOpen

 public void DoesFrameCodeWorkIfTwoBrowsersWithFramesAreOpen()
 {
     using (var ie2 = new IE(FramesetURI))
     {
         var contentsFrame = ie2.Frame(Find.ByName("contents"));
         Assert.IsFalse(contentsFrame.Html.StartsWith("<FRAMESET"), "inner html of frame is expected");
     }
 }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:8,代码来源:FrameTests.cs


示例5: GetBrowser

        public Browser GetBrowser(Uri uri)
        {
            if (ie == null)
            {
                ie = (IE) CreateBrowser(uri);
            }

            return ie;
        }
开发者ID:exaphaser,项目名称:WatiN,代码行数:9,代码来源:IEBrowserTestManager.cs


示例6: CheckIEIsInheritingProperTypes

 public void CheckIEIsInheritingProperTypes()
 {
     using (var ie = new IE())
     {
         Assert.IsInstanceOfType(typeof (IE), ie, "Should be an IE instance");
         Assert.IsInstanceOfType(typeof (Browser), ie, "Should be a Browser instance");
         Assert.IsInstanceOfType(typeof (DomContainer), ie, "Should be a DomContainer instance");
     }
 }
开发者ID:exaphaser,项目名称:WatiN,代码行数:9,代码来源:IETests.cs


示例7: UsingLinqExtensionMethodsWithWatiN_1_3

        public void UsingLinqExtensionMethodsWithWatiN_1_3()
        {
            using (var ie = new IE("www.google.com"))
            {
                var button = ie.Buttons.Where(b => b.GetValue("name") == "btnG").First();

                Assert.That(button.GetValue("Name"), Is.EqualTo("btnG"));
            }
        }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:9,代码来源:DotNet35Tests.cs


示例8: UsingLambdaExpressionsWithWatiN_1_3

        public void UsingLambdaExpressionsWithWatiN_1_3()
        {
            using (var ie = new IE("www.google.com"))
            {
                var textField = ie.TextField(t => t.Name == "q");

                Assert.That(textField.Name, Is.EqualTo("q"));
            }
        }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:9,代码来源:DotNet35Tests.cs


示例9: UsingLinqQueryWithWatiN_1_3

        public void UsingLinqQueryWithWatiN_1_3()
        {
            using (var ie = new IE("www.google.com"))
            {
                var buttons = from button in ie.Buttons
                              where button.GetValue("Name") == "btnG"
                              select button;

                Assert.That(buttons.First().GetValue("Name"), Is.EqualTo("btnG"));
            }
        }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:11,代码来源:DotNet35Tests.cs


示例10: Test2

    static void Test2(IE
ie)
    {
        ie.doom
        ();
        object
        o
        =
        ie.Clone();
        ie.Dispose
        ();
    }
开发者ID:robertmichaelwalsh,项目名称:CSharpFrontEnd,代码行数:12,代码来源:iface6.cs


示例11: 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


示例12: ShouldBeAbleToGetTheMetaTags

 public void ShouldBeAbleToGetTheMetaTags()
 {
     // GIVEN
     using (var browser = new IE(MainURI))
     {
         // WHEN
         var metaTags = browser.ElementsWithTag("meta");
         
         // THEN
         Assert.That(metaTags.Count, Is.EqualTo(1));
     }
 }
开发者ID:exaphaser,项目名称:WatiN,代码行数:12,代码来源:IETests.cs


示例13: FinishInitializationAndWaitForComplete

        public Browser FinishInitializationAndWaitForComplete(IE ie, SimpleTimer timer, bool waitForComplete)
        {
            ie.FinishInitialization(null);

            if (waitForComplete)
            {
                var ieWaitForComplete = new IEWaitForComplete((IEBrowser) ie.NativeBrowser) { Timer = timer };
                ie.WaitForComplete(ieWaitForComplete);
            }

            return ie;
        }
开发者ID:modulexcite,项目名称:FluentSharp_Fork.WatiN,代码行数:12,代码来源:AttachToIeHelper.cs


示例14: Should_detect_error

 public void Should_detect_error()
 {
     using (var ie = new IE())
     {
          var ieClass = (InternetExplorerClass) ie.InternetExplorer;
          var doc = (IHTMLDocument2) ieClass.Document;
          var window = (HTMLWindowEvents_Event) doc.parentWindow;
          window.onerror += (description, url, line) => Console.WriteLine(@"{0}: '{1}' on line {2}", url, description, line);
          ie.GoTo(@"D:\Projects\WatiN\Support\ErrorInJavascript\Test.html");
          ie.GoTo("google.com");
          ie.GoTo(@"D:\Projects\WatiN\Support\ErrorInJavascript\Test.html");
     }
 }
开发者ID:exaphaser,项目名称:WatiN,代码行数:13,代码来源:JavascriptErrorDetection.cs


示例15: 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


示例16: LogonDialogTest

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


示例17: Should_also_handle_dialog_when_more_then_one_browser_is_open

        public void Should_also_handle_dialog_when_more_then_one_browser_is_open()
        {
            var not_used_ie = new IE();
            var approveConfirmDialog = new ConfirmDialogHandler();

            using (new UseDialogOnce(Ie.DialogWatcher, approveConfirmDialog))
            {
                Ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
                approveConfirmDialog.WaitUntilExists(5);
                approveConfirmDialog.OKButton.Click();
            }
            Ie.WaitForComplete();
        }
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:13,代码来源:ConfirmDialogHandlerTests.cs


示例18: CloseBrowser

        public void CloseBrowser()
        {
            if (ie == null) return;
            ie.Close();
            ie = null;
            if (IE.InternetExplorers().Count == 0) return;

            foreach (var explorer in IE.InternetExplorersNoWait())
            {
                Logger.LogDebug(explorer.Title + " (" + explorer.Url + ")");
                explorer.Close();
            }
            throw new Exception("Expected no open IE instances.");
        }
开发者ID:exaphaser,项目名称:WatiN,代码行数:14,代码来源:IEBrowserTestManager.cs


示例19: PositionMousePointerInMiddleOfElementInFrame

        public void PositionMousePointerInMiddleOfElementInFrame()
        {
            Settings.MakeNewIeInstanceVisible = true;
            Settings.HighLightElement = true;

            using (var ie = new IE(FramesetURI))
            {
                var button = ie.Frames[1].Links[0];
                PositionMousePointerInMiddleOfElement(button, ie);
                button.Flash();
                MouseMove(50, 50, true);
                Thread.Sleep(2000);
            }
        }
开发者ID:exaphaser,项目名称:WatiN,代码行数:14,代码来源:PositionMousePointerOnElementTest.cs


示例20: CloseSpecificBrowserAlert

        public void CloseSpecificBrowserAlert()
		{
			Assert.AreEqual(0, Ie.DialogWatcher.Count, "DialogWatcher count should be zero");

		    var firstIE = Ie;
            firstIE.RunScript("document.title = 'firstIe'; ");

            using (var secondIe = new IE(TestPageUri,true))
            {
                secondIe.RunScript("document.title = 'secondIe'; ");
                // set up a second browser with an open dialog
                var secondAlertDialogHandler = new AlertDialogHandler();
                using (new UseDialogOnce(secondIe.DialogWatcher, secondAlertDialogHandler))
                {
                    secondIe.Button(Find.ByValue("Show alert dialog")).ClickNoWait();

                    secondAlertDialogHandler.WaitUntilExists(5);

                    // close the original message
                    var firstAlertDialogHandler = new AlertDialogHandler();
                    using (new UseDialogOnce(firstIE.DialogWatcher, firstAlertDialogHandler))
                    {
                        firstIE.Button(Find.ByValue("Show alert dialog")).ClickNoWait();

                        firstAlertDialogHandler.WaitUntilExists(5);

                        var message = firstAlertDialogHandler.Message;
                        firstAlertDialogHandler.OKButton.Click();

                        firstIE.WaitForComplete(5);

                        Assert.IsTrue(secondAlertDialogHandler.Exists(), "Original Alert Dialog should be open.");

                        Assert.AreEqual("This is an alert!", message, "Unexpected message");
                        Assert.IsFalse(firstAlertDialogHandler.Exists(), "Alert Dialog should be closed.");
                    }

                    // close the second message
                    secondAlertDialogHandler.OKButton.Click();

                    secondIe.WaitForComplete(5);

                    Assert.IsFalse(secondAlertDialogHandler.Exists(), "Alert Dialog should be closed.");
                }
            }
		}
开发者ID:exaphaser,项目名称:WatiN,代码行数:46,代码来源:AlertDialogHandlerTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IEasingFunction类代码示例发布时间:2022-05-24
下一篇:
C# IDynamicMetaObjectProvider类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap