com.gargoylesoftware.htmlunit.html.HtmlParagraph Java Examples

The following examples show how to use com.gargoylesoftware.htmlunit.html.HtmlParagraph. 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: HTMLParagraphElementTest.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception if the test fails
 */
@Test
@Alerts("[object HTMLParagraphElement]")
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"
        + "  <p id='myId'/>\n"
        + "</body></html>";

    final WebDriver driver = loadPageWithAlerts2(html);
    if (driver instanceof HtmlUnitDriver) {
        final HtmlPage page = (HtmlPage) getWebWindowOf((HtmlUnitDriver) driver).getEnclosedPage();
        assertTrue(HtmlParagraph.class.isInstance(page.getHtmlElementById("myId")));
    }
}
 
Example #2
Source File: JadeIT.java    From ozark with Apache License 2.0 5 votes vote down vote up
@Test
public void testConfiguration() throws Exception {
    HtmlPage page = webClient.getPage(webUrl + "jade/config");
    HtmlParagraph systemProperties = page.getFirstByXPath("//p[@class='SystemProperties']");
    assertEquals("SystemProperties", systemProperties.asText());
    HtmlParagraph configFile = page.getFirstByXPath("//p[@class='ConfigFile']");
    assertEquals("ConfigFile", configFile.asText());
}
 
Example #3
Source File: JadeIT.java    From ozark with Apache License 2.0 4 votes vote down vote up
@Test
public void testIncludesViews() throws Exception {
    HtmlPage page = webClient.getPage(webUrl + "jade");
    HtmlParagraph footer = page.getFirstByXPath("//p[@class='footer']");
    assertTrue(footer.asText().contains("Ivar Grimstad"));
}
 
Example #4
Source File: JadeIT.java    From ozark with Apache License 2.0 4 votes vote down vote up
@Test
public void testHelper() throws Exception {
    HtmlPage page = webClient.getPage(webUrl + "jade/helper");
    HtmlParagraph result = page.getFirstByXPath("//p[@class='result']");
    assertEquals("3", result.asText());
}