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

C# SeleniumPage类代码示例

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

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



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


示例16: TestWaitForControlExpectExistButIsNot

        public void TestWaitForControlExpectExistButIsNot()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.Displayed).Returns(false);

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

            var result = page.WaitForElement(element.Object, WaitConditions.Exists, null);

            Assert.IsFalse(result);

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


示例17: TestWaitForControlNotEnabled

        public void TestWaitForControlNotEnabled()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.Enabled).Returns(false);

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

            var result = page.WaitForElement(element.Object, WaitConditions.NotEnabled, null);

            Assert.IsTrue(result);

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


示例18: TestGetClearMethod

        public void TestGetClearMethod()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.Setup(e => e.Clear());

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

            var clearMethod = page.GetClearMethod(null);
            clearMethod(element.Object);

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


示例19: SetupToWaitForElement

 /// <summary>
 /// Sets up the wait for element.
 /// </summary>
 /// <param name="seleniumPage">The selenium page.</param>
 protected void SetupToWaitForElement(SeleniumPage seleniumPage)
 {
     seleniumPage.ExecuteWithElementLocateTimeout = (TimeSpan t, Action work) => work();
     seleniumPage.EvaluateWithElementLocateTimeout = (TimeSpan t, Func<bool> work) => { return work(); };
 }
开发者ID:NickMcG,项目名称:specbind,代码行数:9,代码来源:SeleniumPageFixture.cs


示例20: TestGetFillMethodForStandardInputControl

        public void TestGetFillMethodForStandardInputControl()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.TagName).Returns("input");
            element.Setup(e => e.GetAttribute("type")).Returns("text");
            element.Setup(e => e.SendKeys("Some Text"));

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

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

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SemanticModel类代码示例发布时间:2022-05-24
下一篇:
C# SelectorProtocol类代码示例发布时间: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