Examples of DomNode


Examples of com.gargoylesoftware.htmlunit.html.DomNode

    HtmlPage page = executePageTest("failCajaTest", null);
    NodeList bodyList = page.getElementsByTagName("body");

    // Result should contain just one body
    assertEquals(1, bodyList.getLength());
    DomNode body = (DomNode) bodyList.item(0);

    // Failed output contains only an error block
    assertEquals(1, body.getChildNodes().getLength());
    assertEquals("ul", body.getFirstChild().getNodeName());
  }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode

    * @throws DuplicateClientIDException if more than one client ID matches the suffix
    * @throws ClassCastException if the current page is not an HtmlPage.
    */
   public Element getElement(String componentID)
   {
      DomNode domPage = (DomNode)getContentPage();
      String xpathQuery = buildXPathQuery(componentID);
      List elements = domPage.getByXPath(xpathQuery);
      if (elements.size() == 0) return null;
      if (elements.size() == 1) return (Element)elements.get(0);
      Element exactMatch = findExactMatch(elements, componentID);
      if (exactMatch != null) return exactMatch;
      throw new DuplicateClientIDException(elements, componentID);
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode

        assertEquals("rf-ds-btn rf-ds-btn-prev", previous.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).trim());
    }

    private String getCurrentPageContent(HtmlPage page, int i) throws Exception {
        HtmlElement content = page.getFirstByXPath("//*[@id = 'form:richTable:" + (--i) + ":pageContent']");
        DomNode text = content.getFirstChild();
        assertEquals(DomNode.TEXT_NODE, text.getNodeType());
        return text.getNodeValue();
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode

    HtmlPage page = executePageTest("failCajaTest", null);
    NodeList bodyList = page.getElementsByTagName("body");
   
    // Result should contain just one body
    assertEquals(1, bodyList.getLength());
    DomNode body = (DomNode) bodyList.item(0);

    // Failed output contains only an error block plus a onload script block
    assertEquals(2, body.getChildNodes().getLength());
    assertEquals("pre", body.getFirstChild().getNodeName());
    assertEquals("script", body.getLastChild().getNodeName());
  }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode

{

  private static void processHtml(final Iterable iter, final StringBuffer buf) {
        final Iterator children = iter.iterator();
        while (children.hasNext()) {
            final DomNode node = (DomNode) children.next();
            if (node instanceof DomText) {
                buf.append(((DomText) node).getData());
            } else {
                processHtml(node.getChildren(), buf);
            }
        }
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode

    }

    private static void processHtml(final Iterable iter, final StringBuffer buf) {
      final Iterator children = iter.iterator();
        while (children.hasNext()) {
            final DomNode node = (DomNode) children.next();
            if (!(node instanceof DomText)) {
                buf.append("<").append(node.getNodeName()).append(">");
                processHtml(node.getChildren(), buf);
                buf.append("</").append(node.getNodeName()).append(">");
            }
        }
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode

    HtmlPage page = executePageTest("failCajaTest", null);
    NodeList bodyList = page.getElementsByTagName("body");

    // Result should contain just one body
    assertEquals(1, bodyList.getLength());
    DomNode body = (DomNode) bodyList.item(0);

    // Failed output contains only an error block
    assertEquals(1, body.getChildNodes().getLength());
    assertEquals("ul", body.getFirstChild().getNodeName());
  }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode

    HtmlPage page = executePageTest("failCajaTest", null);
    NodeList bodyList = page.getElementsByTagName("body");
   
    // Result should contain just one body
    assertEquals(1, bodyList.getLength());
    DomNode body = (DomNode) bodyList.item(0);

    // Failed output contains only an error block plus a onload script block
    assertEquals(2, body.getChildNodes().getLength());
    assertEquals("ul", body.getFirstChild().getNodeName());
    assertEquals("script", body.getLastChild().getNodeName());
  }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode

    HtmlElement list = page.getHtmlElementById(clientId + "list");
//    test is list rendered correctly...   
    for (Iterator<HtmlElement> items = list.getChildIterator(); items.hasNext();) {
      HtmlElement span = items.next();
      assertEquals("span", span.getNodeName().toLowerCase());
      DomNode node = span.getFirstDomChild();
        assertEquals(Node.TEXT_NODE, node.getNodeType());
        assertTrue(states.contains(node.getNodeValue()));
      }
  }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode

       
        HtmlElement script = (HtmlElement) div.getFirstChild();
        assertNotNull(script);
        assertEquals("script", script.getNodeName());
       
        DomNode scriptBody = (DomNode) script.getFirstChild();
        assertNotNull(scriptBody);
        assertTrue(scriptBody instanceof DomText);
        String scriptText = scriptBody.asText();
        assertNotNull(scriptText);
        scriptText = scriptText.replaceAll("\\s", "");
       
        assertTrue(scriptText.startsWith("varcontextMenu=newRichfaces.ContextMenu"));
        assertTrue(scriptText.contains(PARAM_SEQUENCE));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.