Package com.gargoylesoftware.htmlunit.html

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


                  "Failed to let google index "
                      + url
                      + " Work on increasing server side performance.");
        }
        if (page != null) {
          pageSource = page.asXml();
        }
      }

      ServletOutputStream out = response.getOutputStream();
      out.println(new String(pageSource));
View Full Code Here


  }

  @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

        password.setValueAttribute("a1z2e3r4!$");
        final HtmlSubmitInput submit = form.getInputByName("_eventId_submit");
        final HtmlPage confirmPage = submit.click();
        final HtmlAnchor anchor = (HtmlAnchor) confirmPage.getElementById("continueButtonLink");
        final HtmlPage confirmPage2 = anchor.click();
        final String content = confirmPage2.asXml();
        final String url = StringUtils.substringBetween(content, "redirectUrl = \"", "\";");
        final HtmlPage callbackPage = webClient.getPage(url);
        final String callbackUrl = callbackPage.getUrl().toString();
        logger.debug("callbackUrl : {}", callbackUrl);
        return callbackUrl;
View Full Code Here

    stringBuilder.append("<hr />\n");
    stringBuilder.append("<center><h3>You are viewing a non-interactive page that is intended for the crawler.  ");
    stringBuilder.append("You probably want to see this page: <a href=\"" + url + "\">" + url + "</a></h3></center>\n");
    stringBuilder.append("<hr />\n");

    stringBuilder.append(page.asXml());
    webClient.closeAllWindows();
    return stringBuilder;
  }

  /**
 
View Full Code Here

    @Test
    public void testELWithParameters(@ArquillianResource URL baseURL) throws Exception {
        WebClient client = new WebClient();
        HtmlPage page = client.getPage(new URL(baseURL, "charlie.jsf"));

        page.asXml();

        HtmlSpan oldel = getFirstMatchingElement(page, HtmlSpan.class, "oldel");
        assertNotNull(oldel);
        final String charlie = "Charlie";
        assertEquals(charlie, oldel.asText());
View Full Code Here

  }

  @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

    // ------------------------------------------------- Individual Test Methods

    public void testMissingView() throws Exception {
  client.setThrowExceptionOnFailingStatusCode(false);
  HtmlPage page = getPage("/faces/jsp/prependId.jsp");
        String pageText = page.asXml();
        // Literal ids with prependId literal
        assertTrue(-1 != pageText.indexOf("span id=\"case1prependIdFalse\""));
        assertTrue(-1 != pageText.indexOf("span id=\"form2:case1prependIdTrue\""));
        assertTrue(-1 != pageText.indexOf("span id=\"form3:case1prependIdUnspecified\""));
 
View Full Code Here

     * <p>Verify that the bean is successfully resolved</p>
     */

    public void testReplaceStateManager() throws Exception {
  HtmlPage page = getPage("/faces/index.jsp");
        String pageText = page.asXml();
        // (?s) is an "embedded flag expression" for the "DOTALL" operator.
        // It says, "let . match any character including line terminators."
        // Because page.asXml() returns a big string with lots of \r\n chars
        // in it, we need (?s).
        // the page contains a table tag with a frame attribute whose value is hsides.
View Full Code Here

    scroller.setRenderIfSinglePage(false);

    HtmlPage page = renderView();
   
    assertNotNull(page);
    System.out.println(page.asXml());
    try {
      page.getHtmlElementById(scroller.getClientId(facesContext)+"_table");
      assertTrue(false);
    } catch(Exception ex) {
    }
View Full Code Here

   */
  @Test
  public void testHelloFacelets() throws Exception {
    WebClient webClient = new LocalWebClient(facesServer);
    HtmlPage page = webClient.getPage("http://localhost/hello.jsf");
    System.out.println(page.asXml());   
    Element submitElement = page.getElementById("helloForm:submit");
    HtmlForm htmlForm = page.getFormByName("helloForm");
    htmlForm.getInputByName("helloForm:username");
    assertNotNull(htmlForm);
    HtmlInput input = htmlForm.getInputByName("helloForm:username");
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.