gpt4 book ai didi

org.mozilla.zest.core.v1.ZestFieldDefinition类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:36:19 26 4
gpt4 key购买 nike

本文整理了Java中org.mozilla.zest.core.v1.ZestFieldDefinition类的一些代码示例,展示了ZestFieldDefinition类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestFieldDefinition类的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestFieldDefinition
类名称:ZestFieldDefinition

ZestFieldDefinition介绍

[英]The Class ZestFieldDefinition.
[中]类ZestFieldDefinition。

代码示例

代码示例来源:origin: mozilla/zest

@Override
public ZestFieldDefinition deepCopy() {
  ZestFieldDefinition ze = new ZestFieldDefinition(this.formName, this.fieldName);
  ze.setFormIndex(this.getFormIndex());
  return ze;
}

代码示例来源:origin: mozilla/zest

/**
   * Gets the key.
   *
   * @return the key
   */
  public String getKey() {
    if (this.formName != null) {
      return this.getFormName() + ":" + this.getFieldName();
    } else {
      return this.getFormIndex() + ":" + this.getFieldName();
    }
  }
}

代码示例来源:origin: mozilla/zest

@Test(expected = ZestAssignFailException.class)
  public void shouldFailTheAssignIfResponseIsNotProvided() throws Exception {
    // Given
    ZestResponse response = null;
    ZestAssignFieldValue assignFieldValue =
        new ZestAssignFieldValue("Var", new ZestFieldDefinition(0, "Field"));
    // When
    assignFieldValue.assign(response, new TestRuntime());
    // Then = ZestAssignFailException
  }
}

代码示例来源:origin: mozilla/zest

@Override
  public String assign(ZestResponse response, ZestRuntime runtime)
      throws ZestAssignFailException {
    if (response == null) {
      throw new ZestAssignFailException(this, "Null response");
    }

    Source src = new Source(response.getHeaders() + response.getBody());
    List<Element> formElements = src.getAllElements(HTMLElementName.FORM);

    if (formElements != null && fieldDefinition.getFormIndex() < formElements.size()) {
      Element form = formElements.get(fieldDefinition.getFormIndex());

      List<Element> inputElements = form.getAllElements(HTMLElementName.INPUT);
      for (Element inputElement : inputElements) {
        if (fieldDefinition.getFieldName().equals(inputElement.getAttributeValue("ID"))
            || fieldDefinition
                .getFieldName()
                .equals(inputElement.getAttributeValue("NAME"))) {
          // Got it
          return inputElement.getAttributeValue("VALUE");
        }
      }
    }

    return null;
  }
}

代码示例来源:origin: mozilla/zest

@Override
public ZestAssignFieldValue deepCopy() {
  ZestAssignFieldValue copy =
      new ZestAssignFieldValue(this.getVariableName(), this.fieldDefinition.deepCopy());
  copy.setEnabled(this.isEnabled());
  return copy;
}

代码示例来源:origin: mozilla/zest

zc2.addIf(req2);
checkOrder(new ZestStatement[] {zc1, req1, zc2, req2, null});
xfrm1.setFieldDefinition(new ZestFieldDefinition(1, "xxx"));
checkOrder(new ZestStatement[] {zc1, req1, zc2, req2, req3, zc3, req4, req5, zc4, null});
zc4.addElse(req6);
xfrm2.setFieldDefinition(new ZestFieldDefinition(1, "xxx"));

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com