Search in sources :

Example 11 with HtmlSpan

use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.

the class MyBeanTest method testAgeGreaterThan.

@Test
public void testAgeGreaterThan() throws IOException {
    nameInputText.setText("abc");
    ageInputText.setText("26");
    zipInputText.setText("12345");
    HtmlPage result = button.click();
    HtmlSpan span = (HtmlSpan) result.getElementById("ageMessage");
    assertEquals("must be less than or equal to 25", span.asText());
}
Also used : HtmlSpan(com.gargoylesoftware.htmlunit.html.HtmlSpan) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) Test(org.junit.Test)

Example 12 with HtmlSpan

use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.

the class MyBeanTest method testAgeLowBoundary.

@Test
public void testAgeLowBoundary() throws IOException {
    nameInputText.setText("abc");
    ageInputText.setText("18");
    zipInputText.setText("12345");
    HtmlPage result = button.click();
    HtmlSpan span = (HtmlSpan) result.getElementById("ageMessage");
    assertEquals("", span.asText());
}
Also used : HtmlSpan(com.gargoylesoftware.htmlunit.html.HtmlSpan) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) Test(org.junit.Test)

Aggregations

HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)12 HtmlSpan (com.gargoylesoftware.htmlunit.html.HtmlSpan)12 Test (org.junit.Test)12 WebClient (com.gargoylesoftware.htmlunit.WebClient)1 URL (java.net.URL)1