Java Code Examples for com.gargoylesoftware.htmlunit.html.HtmlDivision#TAG_NAME

The following examples show how to use com.gargoylesoftware.htmlunit.html.HtmlDivision#TAG_NAME . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SgmlPageTest.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception if the test fails
 */
@Test
public void getElementsByTagNameAsterisk() throws Exception {
    final String html
        = "<html><head><title>First</title></head>\n"
        + "<body>\n"
        + "<form><input type='button' name='button1' value='pushme'></form>\n"
        + "<div>a</div> <div>b</div> <div>c</div>\n"
        + "</body></html>";

    final HtmlPage page = loadPage(html);

    final DomNodeList<DomElement> elements = page.getElementsByTagName("*");

    assertEquals(9, elements.getLength());
    validateDomNodeList(elements);

    final HtmlDivision newDiv = new HtmlDivision(HtmlDivision.TAG_NAME, page, null);
    page.getBody().appendChild(newDiv);
    assertEquals(10, elements.getLength());
    validateDomNodeList(elements);
}
 
Example 2
Source File: SgmlPageTest.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception if the test fails
 */
@Test
public void getElementsByTagNameNSAsterisk() throws Exception {
    final String html
        = "<html><head><title>First</title></head>\n"
        + "<body>\n"
        + "<form><input type='button' name='button1' value='pushme'></form>\n"
        + "<div>a</div> <div>b</div> <div>c</div>\n"
        + "</body></html>";

    final HtmlPage page = loadPage(html);

    final DomNodeList<DomElement> elements = page.getElementsByTagNameNS(Html.XHTML_NAMESPACE, "*");

    assertEquals(9, elements.getLength());
    validateDomNodeList(elements);

    final HtmlDivision newDiv = new HtmlDivision(HtmlDivision.TAG_NAME, page, null);
    page.getBody().appendChild(newDiv);
    assertEquals(10, elements.getLength());
    validateDomNodeList(elements);
}
 
Example 3
Source File: HTMLElement.java    From htmlunit with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor.
 * @param page the page
 * @param target the target
 * @param append append or no
 */
public ProxyDomNode(final SgmlPage page, final DomNode target, final boolean append) {
    super(HtmlDivision.TAG_NAME, page, null);
    target_ = target;
    append_ = append;
}
 
Example 4
Source File: HTMLElement.java    From HtmlUnit-Android with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor.
 * @param page the page
 * @param target the target
 * @param append append or no
 */
public ProxyDomNode(final SgmlPage page, final DomNode target, final boolean append) {
    super(HtmlDivision.TAG_NAME, page, null);
    target_ = target;
    append_ = append;
}