Package com.meterware.httpunit

Examples of com.meterware.httpunit.HTMLElement


     * @param id HTML element id
     * @param text expected contained text
     * @throws Exception
     */
    private void checkTextContent(WebResponse resp,String id,String text) throws Exception {
        HTMLElement element = resp.getElementWithID(id);
        assertNotNull(element);
        assertTrue(element.getText().indexOf(text) != -1);
    }
View Full Code Here


     * @param id HTML element id
     * @param regex expected regex
     * @throws Exception
     */
    private void checkTextRegex(WebResponse resp,String id,String regex) throws Exception {
        HTMLElement element = resp.getElementWithID(id);
        assertNotNull(element);
        Pattern pattern = Pattern.compile(regex);
        // strip new lines from string to be tested
        String text = element.getText().replace("\n","");
        Matcher matcher = pattern.matcher(text);
        if (!matcher.matches())
        {
            fail(element.getText()+" did not match "+regex);
        }
    }
View Full Code Here

     * @param id HTML element id
     * @param text expected text
     * @throws Exception
     */
    private void checkText(WebResponse resp,String id,String text) throws Exception {
        HTMLElement element = resp.getElementWithID(id);
        assertNotNull(element);
        assertEquals(text,element.getText());
    }
View Full Code Here

     * @param id HTML element id
     * @param text expected start of the text
     * @throws Exception
     */
    private void checkTextStart(WebResponse resp,String id,String text) throws Exception {
        HTMLElement element = resp.getElementWithID(id);
        assertNotNull(element);
        assertTrue(element.getText().startsWith(text));
    }
View Full Code Here

     * @param start expected start of the text
     * @param end expected end of the text
     * @throws Exception
     */
    private void checkTextStartEnd(WebResponse resp,String id,String start,String end) throws Exception {
        HTMLElement element = resp.getElementWithID(id);
        assertNotNull(element);
        assertTrue(element.getText().startsWith(start));
        assertTrue(element.getText().endsWith(end));
    }
View Full Code Here

     * @param id HTML element id
     * @param text expected contained text
     * @throws Exception
     */
    private void checkTextContent(WebResponse resp,String id,String text) throws Exception {
        HTMLElement element = resp.getElementWithID(id);
        assertNotNull(element);
        assertTrue(element.getText().indexOf(text) != -1);
    }
View Full Code Here

     * @param id HTML element id
     * @param regex expected regex
     * @throws Exception
     */
    private void checkTextRegex(WebResponse resp,String id,String regex) throws Exception {
        HTMLElement element = resp.getElementWithID(id);
        assertNotNull(element);
        Pattern pattern = Pattern.compile(regex);
        // strip new lines from string to be tested
        String text = element.getText().replace("\n","");
        Matcher matcher = pattern.matcher(text);
        if (!matcher.matches())
        {
            fail(element.getText()+" did not match "+regex);
        }
    }
View Full Code Here

TOP

Related Classes of com.meterware.httpunit.HTMLElement

Copyright © 2018 www.massapicom. 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.