Exemplo n.º 1
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;
  }
Exemplo n.º 2
0
  @Override
  public String toString() {
    StringBuffer buffer = new StringBuffer();
    buffer.append("Statename: " + stateName + "\n");
    buffer.append(
        "<" + element.getNodeName() + " " + DomUtils.getAllElementAttributes(element) + ">");
    if (element.getNodeValue() != null) {
      buffer.append(element.getNodeValue());
    }

    buffer.append("\n");
    // buffer.append("</" + element.getNodeName() + ">\n");

    // buffer.append(Helper.getDocumentToString(element.getOwnerDocument()));

    return buffer.toString();
  }
Exemplo n.º 3
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;
  }
 @BeforeClass
 public static void setup() throws SAXException, IOException {
   document = DomUtils.asDocument("");
 }