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


C# SeleniumPage类代码示例

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


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

示例1: TestGetNativePage

        public void TestGetNativePage()
        {
            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.GetNativePage<NativePage>();
            Assert.AreSame(nativePage, result);
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:8,代码来源:SeleniumPageFixture.cs

示例2: TestGetPageType

        public void TestGetPageType()
        {
            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.PageType;
            Assert.AreEqual(typeof(NativePage), result);
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:8,代码来源:SeleniumPageFixture.cs

示例3: TestGetPageFromElement

        public void TestGetPageFromElement()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.GetPageFromElement(element.Object);

            Assert.IsNotNull(result);
            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:12,代码来源:SeleniumPageFixture.cs

示例4: TestTryGetCorrectElement

        public void TestTryGetCorrectElement()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);

            var nativePage = new NativePage { MyControl = element.Object };
            var page = new SeleniumPage(nativePage);


            IPropertyData propertyData;
            var result = page.TryGetElement("MyControl", out propertyData);

            Assert.IsNotNull(nativePage.MyControl);
            Assert.AreEqual(true, result);
            Assert.IsNotNull(propertyData);
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:15,代码来源:SeleniumPageFixture.cs

示例5: TestGetFillMethodForMultipleSelectControl

        public void TestGetFillMethodForMultipleSelectControl()
        {
            var option = new Mock<IWebElement>(MockBehavior.Strict);
            option.SetupGet(o => o.Selected).Returns(false);
            this.SetupClick(option);

            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.TagName).Returns("select");

            element.Setup(e => e.GetAttribute("multiple")).Returns("true");

            element.Setup(e => e.FindElements(By.TagName("option")))
                   .Returns(new ReadOnlyCollection<IWebElement>(new[] { option.Object }));

            element.Setup(e => e.FindElements(By.XPath(".//option[normalize-space(.) = \"Selected Item\"]")))
                   .Returns(new ReadOnlyCollection<IWebElement>(new[] { option.Object }));

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var fillMethod = page.GetPageFillMethod(null);
            fillMethod(element.Object, "Selected Item");

            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:25,代码来源:SeleniumPageFixture.cs

示例6: TestGetFillMethodForRadioButtonControl

        public void TestGetFillMethodForRadioButtonControl()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.TagName).Returns("input");
            element.Setup(e => e.GetAttribute("type")).Returns("radio");
            this.SetupClick(element);

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var fillMethod = page.GetPageFillMethod(null);
            fillMethod(element.Object, "true");

            element.Verify(e => e.Click(), Times.Exactly(2));
            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:16,代码来源:SeleniumPageFixture.cs

示例7: TestGetFillMethodForCheckboxControl

        public void TestGetFillMethodForCheckboxControl()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.TagName).Returns("input");
            element.Setup(e => e.GetAttribute("type")).Returns("checkbox");
            element.SetupGet(e => e.Selected).Returns(false);
            this.SetupClick(element);

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var fillMethod = page.GetPageFillMethod(null);
            fillMethod(element.Object, "true");

            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:16,代码来源:SeleniumPageFixture.cs

示例8: TestElementEnabledCheckWhenElementNotVisibleExceptionReturnsFalse

        public void TestElementEnabledCheckWhenElementNotVisibleExceptionReturnsFalse()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.Displayed).Throws<ElementNotVisibleException>();

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.ElementEnabledCheck(element.Object);

            Assert.AreEqual(false, result);
            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:13,代码来源:SeleniumPageFixture.cs

示例9: TestGetElementAttributeValueWithValidAttribute

        public void TestGetElementAttributeValueWithValidAttribute()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.Setup(e => e.GetAttribute("href")).Returns("http://myurl.com/page");

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.GetElementAttributeValue(element.Object, "href");

            Assert.AreEqual("http://myurl.com/page", result);

            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:14,代码来源:SeleniumPageFixture.cs

示例10: TestGetClickElement

        public void TestGetClickElement()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            this.SetupClick(element);

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.ClickElement(element.Object);

            Assert.AreEqual(true, result);
            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:13,代码来源:SeleniumPageFixture.cs

示例11: TestGetElementTextWhenControlIsCheckBoxInputControl

        public void TestGetElementTextWhenControlIsCheckBoxInputControl()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.TagName).Returns("input ");
            element.Setup(e => e.GetAttribute("type")).Returns("checkBox");
            element.SetupGet(e => e.Selected).Returns(true);

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.GetElementText(element.Object);

            Assert.AreEqual("True", result);
            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:15,代码来源:SeleniumPageFixture.cs

示例12: TestGetElementTextWhenControlIsTextAreaControl

        public void TestGetElementTextWhenControlIsTextAreaControl()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.TagName).Returns("textarea");
            element.Setup(e => e.GetAttribute("type")).Returns("textarea");
            element.Setup(e => e.GetAttribute("value")).Returns("Input Text Area");

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.GetElementText(element.Object);

            Assert.AreEqual("Input Text Area", result);
            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:15,代码来源:SeleniumPageFixture.cs

示例13: TestGetElementTextWhenControlASelectControlReturnsTheSelectedItemText

        public void TestGetElementTextWhenControlASelectControlReturnsTheSelectedItemText()
        {
            var option = new Mock<IWebElement>(MockBehavior.Strict);
            option.SetupGet(o => o.Selected).Returns(true);
            option.SetupGet(o => o.Text).Returns("Selected Item");

            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.TagName).Returns("select");

            element.Setup(e => e.GetAttribute("multiple")).Returns("false");

            element.Setup(e => e.FindElements(By.TagName("option")))
                   .Returns(new ReadOnlyCollection<IWebElement>(new[] { option.Object }));

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.GetElementText(element.Object);

            Assert.AreEqual("Selected Item", result);
            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:22,代码来源:SeleniumPageFixture.cs

示例14: TestGetElementTextWhenControlIsNotSpecialReturnsTheElementText

        public void TestGetElementTextWhenControlIsNotSpecialReturnsTheElementText()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.TagName).Returns("DIV");
            element.SetupGet(e => e.Text).Returns("Normal Text");

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.GetElementText(element.Object);

            Assert.AreEqual("Normal Text", result);
            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:14,代码来源:SeleniumPageFixture.cs

示例15: TestElementEnabledCheckWhenStaleElementReferenceReturnsFalse

        public void TestElementEnabledCheckWhenStaleElementReferenceReturnsFalse()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.Displayed).Throws<StaleElementReferenceException>();

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.ElementEnabledCheck(element.Object);

            Assert.IsFalse(result);
            element.VerifyAll();
        }
开发者ID:NickMcG,项目名称:specbind,代码行数:13,代码来源:SeleniumPageFixture.cs


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