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


C# IE类代码示例

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


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


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