本文整理了Java中org.mozilla.zest.core.v1.ZestAssignFromElement.<init>()
方法的一些代码示例,展示了ZestAssignFromElement.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestAssignFromElement.<init>()
方法的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestAssignFromElement
类名称:ZestAssignFromElement
方法名:<init>
暂无
代码示例来源:origin: mozilla/zest
@Override
public ZestStatement deepCopy() {
ZestAssignFromElement zestAssignFromElement =
new ZestAssignFromElement(this.getVariableName());
zestAssignFromElement.filterElementName = this.filterElementName;
zestAssignFromElement.elementNameFilter = this.elementNameFilter;
zestAssignFromElement.filterAttributeValue = this.filterAttributeValue;
zestAssignFromElement.attributeNameFilter = this.attributeNameFilter;
zestAssignFromElement.attributeValueFilter = this.attributeValueFilter;
zestAssignFromElement.attributeValueFilterFlags = this.attributeValueFilterFlags;
zestAssignFromElement.attributeValueFilterPattern = this.attributeValueFilterPattern;
zestAssignFromElement.reverseFilteredElements = this.reverseFilteredElements;
zestAssignFromElement.elementIndex = this.elementIndex;
zestAssignFromElement.returnElement = this.returnElement;
zestAssignFromElement.returnAttribute = this.returnAttribute;
zestAssignFromElement.returnedAttributeName = this.returnedAttributeName;
return zestAssignFromElement;
}
}
代码示例来源: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 selectClassAttributeOfLastElement() throws Exception {
// Given
ZestAssignFromElement fromElement =
new ZestAssignFromElement("Var").last().selectAttributeValue("class");
// When
String result = assign(fromElement, testPageA);
// Then
assertEquals("customB", result);
}
代码示例来源: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 noElementFoundReturnsNull() throws Exception {
// Given
ZestAssignFromElement fromElement =
new ZestAssignFromElement("Var").whereElementIs("xyz").first().selectContent();
// When
String result = assign(fromElement, testPageA);
// Then
assertEquals(null, result);
}
代码示例来源:origin: mozilla/zest
@Test
public void filterByElementAndThenSelectTheLastClassAttribute() throws Exception {
// Given
ZestAssignFromElement fromElement =
new ZestAssignFromElement("Var")
.whereElementIs("li")
.last()
.selectAttributeValue("class");
// When
String result = assign(fromElement, testPageA);
// Then
assertEquals("abc14", 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 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 filterByElementAndAttributeThenSelectTheFirstContent() throws Exception {
// Given
ZestAssignFromElement fromElement =
new ZestAssignFromElement("Var")
.whereElementIs("li")
.whereAttributeIs("id", "2")
.first()
.selectContent();
// When
String result = assign(fromElement, testPageA);
// Then
assertEquals("Aliquam tincidunt mauris eu risus.", 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());
}
内容来源于网络,如有侵权,请联系作者删除!