Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.Page


    public static void main(String[] args) throws FailingHttpStatusCodeException,
                                                  MalformedURLException,
                                                  IOException {
        WebClient wc = IntegrationUtils.startWebClient();
        Page page = wc.getPage(url("/util/IntegrationTests.action?flushCobertura="));
        String outputFileName = System.getProperty("com.googlecode.memwords.test.web.integration.datafile");
        if (outputFileName == null) {
            outputFileName = "cobertura/report/cobertura-integration.ser";
        }
        BufferedOutputStream out = null;
        try {
            out = new BufferedOutputStream(new FileOutputStream(new File(outputFileName)));
            out.write(page.getWebResponse().getContentAsBytes());
        }
        finally {
            try {
                out.close();
            }
View Full Code Here


     * Starts a web client and calls the integration tests action bean URL in order
     * to set up the test data in the database
     */
    public static void setUpData() throws Exception {
        WebClient wc = startWebClient();
        Page page = wc.getPage(url("/util/IntegrationTests.action?setUp="));
        assertEquals("OK", page.getWebResponse().getContentAsString());
    }
View Full Code Here

    public static final String CID_HEADER_NAME = "org.jboss.cdi.tck.cid";

    public static final String LONG_RUNNING_HEADER_NAME = "org.jboss.cdi.tck.longRunning";

    protected boolean isCloudDestroyed(WebClient client) throws Exception {
        Page page = client.getPage(getConversationStatusPath("cloudDestroyed"));
        return page.getWebResponse().getStatusCode() == 200;
    }
View Full Code Here

  @Test
  public void checkResources() throws Exception {
    for ( String resource : EXPECTED_RESOURCES ) {
      String url = EndToEndServer.SERVER_URL + '/' + resource;
      Page p = webClient.getPage(url);
      assertEquals("Failed to load test resource " + url, 200, p.getWebResponse().getStatusCode());
    }
  }
View Full Code Here

    webClient.setRedirectEnabled(true);

    String containerJsUrl = EndToEndServer.SERVER_URL + "/gadgets/js/all-features-please.js?container=default&c=1";
    String gadgetJsUrl = EndToEndServer.SERVER_URL + "/gadgets/js/all-features-please.js?container=default&c=0";

    Page containerJsPage = webClient.getPage(containerJsUrl);
    assertEquals(containerJsPage.getWebResponse().getStatusCode(), 200);

    Page gadgetJsPage = webClient.getPage(gadgetJsUrl);
    assertEquals(gadgetJsPage.getWebResponse().getStatusCode(), 200);
  }
View Full Code Here

    url += "&nocache=1";
    if (language != null) {
      url += "&lang=" + language;
    }

    Page page = webClient.getPage(url);
    // wait for window.setTimeout, window.setInterval or asynchronous XMLHttpRequest
    webClient.waitForBackgroundJavaScript(10000);
    if (!(page instanceof HtmlPage)) {
      fail("Got wrong page type. Was: " + page.getWebResponse().getContentType());
    }
    return (HtmlPage) page;
  }
View Full Code Here

            webClient.getOptions().setRedirectEnabled(false);

            // validate CSRF and get authorization code
            String redirectQuery;
            try {
                final Page redirectPage = submitInput.click();
                redirectQuery = redirectPage.getUrl().getQuery();
            } catch (FailingHttpStatusCodeException e) {
                // escalate non redirect errors
                if (e.getStatusCode() != HttpStatus.SC_MOVED_TEMPORARILY) {
                    throw e;
                }
View Full Code Here

              "Script Timeout Error " + executionTime + " > " + allowedTime);
        }
      });
      setupWebClient(webClient);
      try {
        Page page = webClient.getPage(url);
        webClient.waitForBackgroundJavaScriptStartingBefore(2000);
        if (treeLogger.isLoggable(TreeLogger.SPAM)) {
          treeLogger.log(TreeLogger.SPAM, "getPage returned "
              + ((HtmlPage) page).asXml());
        }
View Full Code Here

            webClient.getOptions().setRedirectEnabled(false);

            // validate CSRF and get authorization code
            String redirectQuery;
            try {
                final Page redirectPage = consentAccept.click();
                redirectQuery = redirectPage.getUrl().getQuery();
            } catch (FailingHttpStatusCodeException e) {
                // escalate non redirect errors
                if (e.getStatusCode() != HttpStatus.SC_MOVED_TEMPORARILY) {
                    throw e;
                }
View Full Code Here

        }

        // verify that the conversation can no longer be restored
        {
            client.setThrowExceptionOnFailingStatusCode(false);
            Page page = client.getPage(getPath("/display", cid));
            assertEquals(page.getWebResponse().getStatusCode(), 500);
        }
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.Page

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.