コード例 #1
0
  private boolean xpathInput(
      EmbeddedBrowser browser, StateVertex vertex, String path, String value) {
    log.debug("xpathInput(EmbeddedBrowser browser, StateVertex vertex, String path, String value)");
    Document doc = null;
    try {
      doc = vertex.getDocument();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    assert (doc != null);
    if (xpathQuery(doc, path)) {
      Identification id = new Identification();
      id.setHow(How.xpath);
      id.setValue(path);
      try {
        return browser.input(id, value);
      } catch (CrawljaxException e) {
        log.debug(e.getMessage());
        return false;
      }
    }

    return false;
  }
コード例 #2
0
  private boolean xpathInput(EmbeddedBrowser browser, String path, String value) {
    log.info("xpathInput(EmbeddedBrowser browser, String path, String value)");
    assert (browser != null);
    Document doc = null;

    try {
      doc = DomUtils.asDocument(browser.getStrippedDom());
    } catch (IOException e) {
      log.debug(e.getMessage());
      return false;
    }

    assert (doc != null);
    if (xpathQuery(doc, path)) {
      Identification id = new Identification();
      id.setHow(How.xpath);
      id.setValue(path);
      try {
        log.info("Browser input\n");
        log.info(How.xpath.toString());
        log.info(path);
        return browser.input(id, value);
      } catch (CrawljaxException e) {
        log.info(e.getMessage());
        return false;
      }
    }

    return false;
  }