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

x33g5p2x  于2022-02-05 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(90)

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

ZestLoopClientElements介绍

[英]This class represent a loop through a list of strings given in input through a file.
[中]此类表示通过文件输入中给定的字符串列表的循环。

代码示例

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

@Override
public ZestLoopClientElements deepCopy() {
  ZestLoopClientElements copy;
  copy = new ZestLoopClientElements(this.getIndex());
  copy.setVariableName(getVariableName());
  copy.setCurrentState(this.getCurrentState().deepCopy());
  copy.setStatements(this.copyStatements());
  copy.setSet(this.getSet().deepCopy());
  copy.setEnabled(this.isEnabled());
  return copy;
}

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

@Override
public void toLastState() {
  getCurrentState().toLastState(getSet());
}

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

@Test
public void testClientXpathLoopReturningType() throws Exception {
  ZestScript script = new ZestScript();
  script.add(new ZestClientLaunch("htmlunit", "HtmlUnit", getServerUrl(PATH_SERVER_FILE)));
  ZestLoopClientElements loop =
      new ZestLoopClientElements("val", "htmlunit", "xpath", "//*", "type");
  loop.addStatement(new ZestActionPrint("{{val}}"));
  script.add(loop);
  script.add(new ZestClientWindowClose("htmlunit", 0));
  ZestBasicRunner runner = new ZestBasicRunner();
  // Uncomment this to proxy via ZAP
  // runner.setProxy("localhost", 8090);
  StringWriter sw = new StringWriter();
  runner.setOutputWriter(sw);
  runner.run(script, null);
  assertEquals("text\n" + "password\n" + "select-one\n" + "submit\n", sw.toString());
}

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

public String getAttribute() {
  return getSet().getAttribute();
}

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

@Override
public String getCurrentToken() {
  if (super.getCurrentToken() == null) {
    super.init(getSet(), getStatements());
  }
  return super.getCurrentToken();
}

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

WebDriver wd = this.loop.getRuntime().getWebDriver(getWindowHandle());

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

@Test
public void testClientXpathLoopReturningName() throws Exception {
  ZestScript script = new ZestScript();
  script.add(new ZestClientLaunch("htmlunit", "HtmlUnit", getServerUrl(PATH_SERVER_FILE)));
  ZestLoopClientElements loop =
      new ZestLoopClientElements("val", "htmlunit", "xpath", "//*", "name");
  loop.addStatement(new ZestActionPrint("{{val}}"));
  script.add(loop);
  script.add(new ZestClientWindowClose("htmlunit", 0));
  ZestBasicRunner runner = new ZestBasicRunner();
  // Uncomment this to proxy via ZAP
  // runner.setProxy("localhost", 8090);
  StringWriter sw = new StringWriter();
  runner.setOutputWriter(sw);
  runner.run(script, null);
  // Expected string split up for clarity
  assertEquals("something\n" + "a\n" + "b\n" + "c" + "\n" + "submit\n", sw.toString());
}

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

public void setAttribute(String attribute) {
    getSet().setAttribute(attribute);
  }
}

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

@Test
public void testClientXpathLoopReturningText() throws Exception {
  ZestScript script = new ZestScript();
  script.add(new ZestClientLaunch("htmlunit", "HtmlUnit", getServerUrl(PATH_SERVER_FILE)));
  ZestLoopClientElements loop =
      new ZestLoopClientElements(
          "val", "htmlunit", "xpath", "//input[@type='text']", "name");
  loop.addStatement(new ZestActionPrint("{{val}}"));
  script.add(loop);
  script.add(new ZestClientWindowClose("htmlunit", 0));
  ZestBasicRunner runner = new ZestBasicRunner();
  // Uncomment this to proxy via ZAP
  // runner.setProxy("localhost", 8090);
  StringWriter sw = new StringWriter();
  runner.setOutputWriter(sw);
  runner.run(script, null);
  assertEquals("a\n", sw.toString());
}

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

public void endLoop() {
  super.endLoop(getSet());
}

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

public String getWindowHandle() {
  return getSet().getWindowHandle();
}

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

public String getType() {
  return getSet().getType();
}

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

public void setWindowHandle(String windowHandle) {
  getSet().setWindowHandle(windowHandle);
}

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

public void setElement(String element) {
  getSet().setElement(element);
}

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

public boolean loop() {
  return super.loop(getSet());
}

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

public String getElement() {
  return getSet().getElement();
}

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

public void setType(String type) {
  getSet().setType(type);
}

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

@Override
public boolean isLastState() {
  return super.getCurrentState().isLastState(getSet());
}

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

@Override
public void increase() {
  super.getCurrentState().increase(getSet());
}

相关文章