예제 #1
0
 private String textOfElementWithClass(Element[] elements, String clazz) {
   for (Element div : elements) {
     if (clazz.equals(div.getAttributeValue("class"))) {
       return div.getText();
     }
   }
   return "";
 }
예제 #2
0
 public boolean hasEmbeddedCSS(String css) {
   Element head = getHeadElement();
   for (Element style : head.getChildElements("style")) {
     if (style.getText().contains(css)) {
       return true;
     }
   }
   return false;
 }
예제 #3
0
  public String getElementXML(String className) {
    Element[] childDivs = getRootElement().getDescendantElements("div");

    for (Element div : childDivs) {
      if (className.equals(div.getAttributeValue("class"))) {
        return div.toXML();
      }
    }
    return "";
  }
예제 #4
0
 public boolean hasEmbeddedJavaScript(String javaScript) {
   Element head = getHeadElement();
   for (Element script : head.getChildElements("script")) {
     String type = script.getAttributeValue("type");
     if ("text/javascript".equals(type) && script.getText().contains(javaScript)) {
       return true;
     }
   }
   return false;
 }
예제 #5
0
 public boolean hasJavaScriptDeclaration(String cssFilename) {
   Element head = getHeadElement();
   for (Element script : head.getChildElements("script")) {
     String type = script.getAttributeValue("type");
     String src = script.getAttributeValue("src");
     if ("text/javascript".equals(type) && cssFilename.equals(src)) {
       return true;
     }
   }
   return false;
 }
예제 #6
0
 public boolean hasCSSDeclaration(String cssFilename) {
   Element head = getHeadElement();
   for (Element link : head.getChildElements("link")) {
     String href = link.getAttributeValue("href");
     String type = link.getAttributeValue("type");
     String rel = link.getAttributeValue("rel");
     if (cssFilename.equals(href) && "text/css".equals(type) && "stylesheet".equals(rel)) {
       return true;
     }
   }
   return false;
 }
예제 #7
0
  @Override
  public void verify(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) {
    Check.isFalse(
        commandCall.hasChildCommands(), "Nesting commands inside an 'echo' is not supported");

    Object result = evaluator.evaluate(commandCall.getExpression());

    Element element = commandCall.getElement();
    if (result != null) {
      element.appendText(result.toString());
    } else {
      Element child = new Element("em");
      child.appendText("null");
      element.appendChild(child);
    }
  }