本文整理了Java中org.mozilla.zest.core.v1.ZestAssignFromElement.atIndex()
方法的一些代码示例,展示了ZestAssignFromElement.atIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestAssignFromElement.atIndex()
方法的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestAssignFromElement
类名称:ZestAssignFromElement
方法名:atIndex
暂无
代码示例来源:origin: mozilla/zest
public ZestAssignFromElement atIndex(int index) {
return atIndex(index, false);
}
代码示例来源:origin: mozilla/zest
public ZestAssignFromElement first() {
return atIndex(0);
}
代码示例来源:origin: mozilla/zest
public ZestAssignFromElement last() {
return atIndex(0, true);
}
代码示例来源:origin: mozilla/zest
@Test(expected = ZestAssignFailException.class)
public void invalidRegExShouldThrowAZestAssignFailException() throws Exception {
// Given
ZestAssignFromElement fromElement =
new ZestAssignFromElement("Var")
.whereAttributeIs("title", "[")
.atIndex(0)
.selectContent();
// When
assign(fromElement, testPageB);
// Then = ZestAssignFailException
}
代码示例来源:origin: mozilla/zest
@Test
public void selectActionAttributeOfSecondForm() throws Exception {
// Given
ZestAssignFromElement fromElement =
new ZestAssignFromElement("Var")
.whereElementIs("form")
.atIndex(1)
.selectAttributeValue("action");
// When
String result = assign(fromElement, testPageB);
// Then
assertEquals("foo.html#site=456", result);
}
代码示例来源:origin: mozilla/zest
@Test
public void filterByValueIsStartingWithChoiceAndSelectContentOfSecondItem() throws Exception {
// Given
ZestAssignFromElement fromElement =
new ZestAssignFromElement("Var")
.whereAttributeIs("value", "Choice.*")
.atIndex(1)
.selectContent();
// When
String result = assign(fromElement, testPageB);
// Then
assertEquals("Choice 2", result);
}
代码示例来源:origin: mozilla/zest
@Test
public void filterBeforeLastDivAndSelectContent() throws Exception {
// Given
ZestAssignFromElement fromElement =
new ZestAssignFromElement("Var")
.whereElementIs("div")
.atIndex(1, true)
.selectContent();
// When
String result = assign(fromElement, testPageB);
// Then
assertEquals("<input type=\"submit\" value=\"Submit\" />", result);
}
代码示例来源:origin: mozilla/zest
@Test
public void testSerialization() {
ZestAssignFromElement fromElement =
new ZestAssignFromElement("Var")
.whereElementIs("form")
.atIndex(1)
.selectAttributeValue("action");
String str = ZestJSON.toString(fromElement);
ZestAssignFromElement fromElement2 = (ZestAssignFromElement) ZestJSON.fromString(str);
assertEquals(fromElement.getElementType(), fromElement2.getElementType());
assertEquals(fromElement.getVariableName(), fromElement2.getVariableName());
assertEquals(fromElement.getAttributeNameFilter(), fromElement2.getAttributeNameFilter());
assertEquals(fromElement.getAttributeValueFilter(), fromElement2.getAttributeValueFilter());
assertEquals(fromElement.getElementNameFilter(), fromElement2.getElementNameFilter());
assertEquals(
fromElement.getReturnedAttributeName(), fromElement2.getReturnedAttributeName());
assertEquals(
fromElement.getAttributeValueFilterFlags(),
fromElement2.getAttributeValueFilterFlags());
assertEquals(fromElement.getElementIndex(), fromElement2.getElementIndex());
assertEquals(
fromElement.areFilteredElementsReversed(),
fromElement2.areFilteredElementsReversed());
assertEquals(fromElement.isReturningAttribute(), fromElement2.isReturningAttribute());
assertEquals(fromElement.isReturningElement(), fromElement2.isReturningElement());
assertEquals(fromElement.isFilteredByAttribute(), fromElement2.isFilteredByAttribute());
assertEquals(fromElement.isFilteredByElementName(), fromElement2.isFilteredByElementName());
}
内容来源于网络,如有侵权,请联系作者删除!