com.gargoylesoftware.htmlunit.html.HtmlUnorderedList Java Examples

The following examples show how to use com.gargoylesoftware.htmlunit.html.HtmlUnorderedList. 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: HTMLUListElementTest.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception if the test fails
 */
@Test
@Alerts("[object HTMLUListElement]")
public void simpleScriptable() throws Exception {
    final String html = "<html><head>\n"
        + "<script>\n"
        + "  function test() {\n"
        + "    alert(document.getElementById('myId'));\n"
        + "  }\n"
        + "</script>\n"
        + "</head><body onload='test()'>\n"
        + "  <ul id='myId'/>\n"
        + "</body></html>";

    final WebDriver driver = loadPageWithAlerts2(html);
    if (driver instanceof HtmlUnitDriver) {
        final WebElement element = driver.findElement(By.id("myId"));
        assertTrue(toHtmlElement(element) instanceof HtmlUnorderedList);
    }
}
 
Example #2
Source File: JadeIT.java    From ozark with Apache License 2.0 4 votes vote down vote up
@Test
public void testUsesFilters() throws Exception {
    HtmlPage page = webClient.getPage(webUrl + "jade/markdown");
    HtmlUnorderedList ul = page.getFirstByXPath("//html/body/ul");
    assertEquals(3, ul.getChildElementCount());
}