Examples of asXML()


Examples of com.gargoylesoftware.htmlunit.html.DomElement.asXml()

            element = page.getElementsByTagName(locator).get(0);
        } else {
            throw new IllegalArgumentException("Only id and name are supported");
        }

        String pageCode = element.asXml();

        checkXmlStructure(xmlunitPage, pageCode);
    }

    protected void checkXmlStructure(String xmlunitPage, String pageCode) throws SAXException, IOException {
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.DomNode.asXml()

                if (getBrowserVersion().isIE() && xml.endsWith("\r\n")) {
                    xml = xml.substring(0, xml.length() - 2);
                }
                return xml;
            }
            return node.asXml();
        }
        return Undefined.instance;
    }

    /**
 
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlElement.asXml()

    protected void doTest(String pageName, String xmlunitPageName, String pageElementToTest) throws IOException, SAXException {
        HtmlPage page = environment.getPage('/' + pageName + ".jsf");
        HtmlElement htmlElement = (HtmlElement) page.getElementById(pageElementToTest);
        assertNotNull(htmlElement);

        String pageCode = htmlElement.asXml();

        checkXmlStructure(pageName, xmlunitPageName, pageCode);
    }

    protected void checkXmlStructure(String pageName, String xmlunitPageName, String pageCode) throws SAXException, IOException {
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm.asXml()

        waitForJavaScript(p);
        // select banana in 2nd select element:
        ((HtmlSelect)f.getElementsByTagName("select").get(1)).getOption(1).click();
        f.getInputsByName("yellow").get(1).click(); // checkbox
        f.getInputsByValue("").get(1).setValueAttribute("split"); // word
        String xml = f.asXml();
        bindClass = Fruity.class;
        submit(f);
        assertEquals(formData + "\n" + xml,
                     "[Apple with 17 seeds pie, Yellow Banana split]", bindResult.toString());
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput.asXml()

      DomNode table = (DomNode)jsfClient.getElement(componentID + "Buttons");
      List inputs = table.getByXPath("tbody/tr/td/input");
      for (Iterator i = inputs.iterator(); i.hasNext();)
      {
         HtmlInput input = (HtmlInput)i.next();
         if (input.asXml().contains(imageName))
         {
            input.click();
            return;
         }
      }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlPage.asXml()

  }

  @Test
  public void testTemplateLibrary() throws Exception {
    HtmlPage page = executeAllPageTests("templateLibrary");
    String pageXml = page.asXml();
    assertTrue(pageXml.replaceAll("[\n\r ]", "").contains("p{color:red}"));

    Node paragraph = page.getElementsByTagName("p").item(0);
    assertEquals("Hello world", paragraph.getTextContent().trim());
  }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlPage.asXml()

        System.out.println(raw.getContent());
        String nl = System.getProperty("line.separator");
        assertTrue(raw.getContent().contains(nl+"---"+nl+"ooo"+nl+"ooo"+nl));

        // there should be two 'ooo's
        assertEquals(3,rsp.asXml().split("ooo").length);
    }

    /**
     * Only annotates the first occurrence of "ooo".
     */
 
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlPage.asXml()

        logger.info("Creating snapshot for page ["+page+"], escapedFragment ["+escapedFragment+"]");
        HtmlPage htmlPage = webClient.getPage(CrawlingUtils.rewriteUrl(applicationBaseURL, page, escapedFragment));
        webClient.waitForBackgroundJavaScript(javascriptTime);
        File outputFile = new File(outputDir, pagePath);
        //htmlPage.save(outputFile) creates the whole site structure, with images and CSS files locally. So use asXML instead
        StreamUtils.write(new ByteArrayInputStream(htmlPage.asXml().getBytes("UTF-8")), new FileOutputStream(outputFile), true);
        webClient.closeAllWindows();
      }
        }
        catch (Exception e)
        {
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlPage.asXml()

            + "You probably want to see this page: <a href=\""
            + pageName
            + "\">" + pageName + "</a></h3></center>");
        out.println("<hr />");

        out.println(page.asXml());
        webClient.closeAllWindows();

        out.println("");
        out.close();
      } catch (Throwable e) {
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlPage.asXml()

  }

  @Test
  public void testTemplateLibrary() throws Exception {
    HtmlPage page = executeAllPageTests("templateLibrary");
    assertTrue(page.asXml().contains("p {color: red}"));
   
    Node paragraph = page.getElementsByTagName("p").item(0);
    assertEquals("Hello world", paragraph.getTextContent().trim());
  }
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.