本文整理汇总了C#中NativePage类的典型用法代码示例。如果您正苦于以下问题:C# NativePage类的具体用法?C# NativePage怎么用?C# NativePage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NativePage类属于命名空间,在下文中一共展示了NativePage类的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);
}
示例2: TestGetPageType
public void TestGetPageType()
{
var nativePage = new NativePage();
var page = new SeleniumPage(nativePage);
var result = page.PageType;
Assert.AreEqual(typeof(NativePage), result);
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例8: 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();
}
示例9: 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();
}
示例10: 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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}