本文整理汇总了C#中SeleniumPage.GetElementText方法的典型用法代码示例。如果您正苦于以下问题:C# SeleniumPage.GetElementText方法的具体用法?C# SeleniumPage.GetElementText怎么用?C# SeleniumPage.GetElementText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SeleniumPage
的用法示例。
在下文中一共展示了SeleniumPage.GetElementText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}