예제 #1
0
  public boolean executeInput(EmbeddedBrowser browser, BioFuzzFieldInput in) {
    log.info("executeInput(EmbeddedBrowser browser,Input in)");
    assert (browser != null);
    assert (in != null);

    switch (in.getAction()) {
      case TEXT_INPUT:
        log.info("text input");
        boolean ret = true;
        for (String elementId : in.getElementIds()) {
          log.debug("execute input for" + elementId);
          ret = ret && xpathInput(browser, elementId, in.getInputValue());
        }
        return ret;
      case CLICK:
        log.debug("click");
        assert (in.getElementIds().size() > 0);
        return xpathEvent(browser, in.getElementId(0), EventType.click);
      case GO_TO_URL:
        log.debug("go to url");
        try {
          browser.goToUrl(new URL(in.getInputValue()));
          return true;
        } catch (MalformedURLException e) {
          // TODO Auto-generated catch block
          return false;
        }
      default:
        break;
    }

    return false;
  }
예제 #2
0
  public boolean executeInput(EmbeddedBrowser browser, StateVertex vertex, BioFuzzFieldInput in) {
    log.debug("executeInput(EmbeddedBrowser browser,StateVertex vertex,Input in) ");
    log.debug("Input: " + in.toString());
    assert (browser != null);
    assert (vertex != null);
    assert (in != null);
    switch (in.getAction()) {
      case TEXT_INPUT:
        boolean ret = true;
        for (String elementId : in.getElementIds()) {
          ret = ret & xpathInput(browser, vertex, elementId, in.getInputValue());
        }
        return ret;
      case CLICK:
        return xpathEvent(browser, vertex, in.getElementId(0), EventType.click);
      case GO_TO_URL:
        try {
          browser.goToUrl(new URL(in.getInputValue()));
          return true;
        } catch (MalformedURLException e) {
          // TODO Auto-generated catch block
          return false;
        }
    }

    return false;
  }