Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlPage


   }

   @Test
   public void testHCommandLinkExtraParams() throws Exception
   {
      HtmlPage firstPage = getWebClient("/index").getPage();
      HtmlPage secondPage = firstPage.getHtmlElementById("hCommandLink-extra").click();
      assertThat(secondPage.getUrl().toString(), endsWith("/view-hardcoded-params?extraParam=extraValue"));
   }
View Full Code Here


   }

   @Test
   public void testHCommandLinkInvalid() throws Exception
   {
      HtmlPage firstPage = getWebClient("/index").getPage();
      HtmlPage secondPage = firstPage.getHtmlElementById("hCommandLink-notMapped").click();
      assertThat(secondPage.getUrl().toString(), endsWith("/view-hardcoded-params.jsf?param=value2"));
   }
View Full Code Here

   }

   @Test
   public void testNavigate() throws Exception
   {
      HtmlPage firstPage = getWebClient("/page").getPage();
      HtmlPage secondPage = firstPage.getHtmlElementById("navigate").click();
      assertEquals(secondPage.getUrl().getPath(), getContextPath() + "/page");
   }
View Full Code Here

   @Test
   public void testRedirectSimpleString() throws Exception
   {

      HtmlPage firstPage = getWebClient("/navigate").getPage();
      HtmlPage secondPage = firstPage.getHtmlElementById("form:redirectSimpleString").click();

      assertThat(secondPage.getWebResponse().getWebRequest().getHttpMethod(), is(HttpMethod.GET));
      assertThat(secondPage.getUrl().toString(), endsWith("/navigate?q=foo"));

      String secondPageContent = secondPage.getWebResponse().getContentAsString();
      assertThat(secondPageContent, containsString("Value = [foo]"));

   }
View Full Code Here

   @Test
   public void testOutcomeRedirectSimple() throws Exception
   {

      HtmlPage startPage = getWebClient("/start").getPage();
      HtmlPage secondPage = startPage.getHtmlElementById("form:redirectSimple").click();

      assertThat(secondPage.getUrl().toString(), endsWith("/page/foo?query=foo"));

   }
View Full Code Here

   @Test
   public void testRedirectWithSpace() throws Exception
   {

      HtmlPage firstPage = getWebClient("/navigate").getPage();
      HtmlPage secondPage = firstPage.getHtmlElementById("form:redirectWithSpace").click();

      assertThat(secondPage.getWebResponse().getWebRequest().getHttpMethod(), is(HttpMethod.GET));
      assertThat(secondPage.getUrl().toString(), endsWith("/navigate?q=foo+bar"));

      String secondPageContent = secondPage.getWebResponse().getContentAsString();
      assertThat(secondPageContent, containsString("Value = [foo bar]"));

   }
View Full Code Here

   @Test
   public void testOutcomeRedirectWithSpace() throws Exception
   {

      HtmlPage startPage = getWebClient("/start").getPage();
      HtmlPage secondPage = startPage.getHtmlElementById("form:redirectWithSpace").click();

      assertThat(secondPage.getUrl().toString(), endsWith("/page/foo%20bar?query=foo+bar"));

   }
View Full Code Here

            + "this is JSF doing something bad here afaik. Perhaps something to do with:"
            + "'include-view-params=true' ?")
   public void testOutcomeRedirectWithEqual() throws Exception
   {

      HtmlPage startPage = getWebClient("/start").getPage();
      HtmlPage secondPage = startPage.getHtmlElementById("form:redirectWithEqual").click();

      assertThat(secondPage.getUrl().toString(), endsWith("/page/foo%3Dbar&query=foo%3Dbar"));

   }
View Full Code Here

   @Test
   public void testRedirectWithAmpersand() throws Exception
   {

      HtmlPage firstPage = getWebClient("/navigate").getPage();
      HtmlPage secondPage = firstPage.getHtmlElementById("form:redirectWithAmpersand").click();

      assertThat(secondPage.getWebResponse().getWebRequest().getHttpMethod(), is(HttpMethod.GET));
      assertThat(secondPage.getUrl().toString(), endsWith("/navigate?q=foo%26bar"));

      String secondPageContent = secondPage.getWebResponse().getContentAsString();
      assertThat(secondPageContent, containsString("Value = [foo&bar]"));

   }
View Full Code Here

            + "JSF is still dropping 'bar' incorrectly, but I wouldn't expect it to be included "
            + "in the path param of the rewritten URL.")
   public void testOutcomeRedirectWithAmpersand() throws Exception
   {

      HtmlPage startPage = getWebClient("/start").getPage();
      HtmlPage secondPage = startPage.getHtmlElementById("form:redirectWithAmpersand").click();

      /*
       * Christian thinks:
       */
      // assertThat(secondPage.getUrl().toString(), endsWith("/page/foo%26bar&query=foo%26bar"));

      /*
       * Lincoln thinks:
       */
      assertThat(secondPage.getUrl().toString(), endsWith("/page/foo?bar&query=foo&bar"));

   }
View Full Code Here

TOP

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

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.