Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.DomText


     * {@inheritDoc}
     */
    @Override
    public Node jsxGet_lastChild() {
        if (getBrowserVersion().isFirefox()) {
            final DomText text = new DomText(getDomNodeOrDie().getPage(), jsxGet_nodeValue());
            return (Node) text.getScriptObject();
        }
        return null;
    }
View Full Code Here


            for (int i = 0; i < children.getLength(); i++) {
                XmlUtil.appendChild(parentPage, parent, children.item(i));
            }
        }
        else {
            final DomText text = new DomText(parent.getPage(), (String) result);
            parent.appendChild(text);
        }
    }
View Full Code Here

        }

        domNode.removeAllChildren();

        if (value != null && value.length() != 0) {
            domNode.appendChild(new DomText(domNode.getPage(), Context.toString(value)));
        }

        //if the parentNode has null parentNode in IE,
        //create a DocumentFragment to be the parentNode's parentNode.
        if (domNode.getParentNode() == null && getBrowserVersion().isIE()) {
View Full Code Here

     */
    public void jsxSet_text(final String text) {
        final DomNode htmlElement = getDomNodeOrDie();
        DomNode firstChild = htmlElement.getFirstChild();
        if (firstChild == null) {
            firstChild = new DomText(htmlElement.getPage(), text);
            htmlElement.appendChild(firstChild);
        }
        else {
            firstChild.setNodeValue(text);
        }
View Full Code Here

     */
    public void jsxSet_text(final String text) {
        final DomNode htmlElement = getDomNodeOrDie();
        DomNode firstChild = htmlElement.getFirstChild();
        if (firstChild == null) {
            firstChild = new DomText(htmlElement.getPage(), text);
            htmlElement.appendChild(firstChild);
        }
        else {
            firstChild.setNodeValue(text);
        }
View Full Code Here

                page, HtmlOption.TAG_NAME, attributes);
        htmlOption.setSelected(selected);
        setDomNode(htmlOption);

        if (newText != null && !newText.equals("undefined")) {
            htmlOption.appendChild(new DomText(page, newText));
        }
        if (newValue != null && !newValue.equals("undefined")) {
            htmlOption.setValueAttribute(newValue);
        }
    }
View Full Code Here

            for (int i = currentLength; i < newLength; i++) {
                final HtmlOption option = (HtmlOption) HTMLParser.getFactory(HtmlOption.TAG_NAME).createElement(
                        htmlSelect_.getPage(), HtmlOption.TAG_NAME, null);
                htmlSelect_.appendOption(option);
                if (!getBrowserVersion().isIE()) {
                    option.appendChild(new DomText(option.getPage(), ""));
                }
            }
        }
    }
View Full Code Here

    }

    private String getQueueScript(HtmlPage page) throws JaxenException {
        List<?> list = page.getByXPath("//head/script[@id='" + QueueScriptResourceRenderer.QUEUE_SCRIPT_ID
                + "']/text()");
        DomText text = (DomText) list.get(0);
        String scriptData = text.getData();

        return scriptData.replaceAll(
                "^\\Qif (typeof A4J != 'undefined') { if (A4J.AJAX) { with (A4J.AJAX) {\\E|\\Q}}};\\E$", "");
    }
View Full Code Here

    @Test
    public void testEdit() throws Exception {
        HtmlPage page = environment.getPage("/inplaceInputTest.jsf");
        edit(page, BASE_ID + DEFAULT, "Another Test String");
        blur(page);
        DomText text = page.getFirstByXPath("//*[@id = '" + BASE_ID + "DefaultLabel']/text()");
        assertEquals("Another Test String", text.getTextContent());
        HtmlElement span = page.getFirstByXPath("//*[@id = '" + BASE_ID + DEFAULT + "']");
        assertEquals("rf-ii rf-ii-chng", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
    }
View Full Code Here

        HtmlElement cancel = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Cancelbtn']");
        assertNotNull(cancel);
        cancel.mouseDown();

        DomText text = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Label']/text()");
        assertNotNull(text);
        assertEquals("Edit Text", text.getTextContent());

        HtmlElement span = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "']");
        assertNotNull(span);
        assertEquals("rf-ii", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));

        edit(page, withControlsComponentId, "Another Test String");

        HtmlElement ok = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Okbtn']");
        assertNotNull(ok);
        ok.mouseDown();

        text = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Label']/text()");
        assertNotNull(text);
        assertEquals("Another Test String", text.getTextContent());

        span = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "']");
        assertNotNull(span);
        assertEquals("rf-ii rf-ii-chng", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));

        edit(page, withControlsComponentId, "Test String");

        blur(page);

        text = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Label']/text()");
        assertNotNull(text);
        assertEquals("Test String", text.getTextContent());
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.DomText

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.