Пример #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
  public boolean xpathEvent(EmbeddedBrowser browser, StateVertex vertex, String path, EventType t) {
    log.debug("xpathEvent(EmbeddedBrowser browser, StateVertex vertex, String path, EventType t)");
    log.debug("path: " + path);
    Document doc = null;
    try {
      doc = vertex.getDocument();
    } catch (IOException e) {
      log.debug("exception");
      log.debug(e.getMessage());
      log.debug(e.getCause().toString());
      return false;
    }
    assert (doc != null);
    if (xpathQuery(doc, path)) {
      Identification id = new Identification();
      id.setHow(How.xpath);
      id.setValue(path);
      Eventable ev = new Eventable();
      ev.setEventType(t);
      ev.setIdentification(id);

      return fireEvent(ev, browser);
    }
    return false;
  }
Пример #3
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;
  }
Пример #4
0
  public boolean xpathEvent(EmbeddedBrowser browser, String path, EventType t) {
    log.debug("xpathEvent without start\n");
    Document doc = null;
    assert (browser != 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);
      Eventable ev = new Eventable();
      ev.setEventType(t);
      ev.setIdentification(id);

      return fireEvent(ev, browser);
    }
    return false;
  }