Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlPage


   @Test
   public void testNavigateStringWithSpace() throws Exception
   {

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

      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 testNavigateProblematicCharacters() throws Exception
   {

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

      assertThat(secondPage.getUrl().toString(), endsWith("/navigate?q=foo%3Dbar"));

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

   }
View Full Code Here

   @Test
   public void testActionPhases() throws Exception
   {

      HtmlPage firstPage = getWebClient("/action").getPage();

      // reload so we get a postback that visits all the phases
      HtmlPage secondPage = firstPage.getHtmlElementById("form:reload").click();

      String secondPageContent = secondPage.getWebResponse().getContentAsString();
      assertContains(secondPageContent, "Action 1 = RESTORE_VIEW");
      assertContains(secondPageContent, "Action 2 = RENDER_RESPONSE");
      assertContains(secondPageContent, "Action 3 = INVOKE_APPLICATION");

   }
View Full Code Here

   @Test
   public void testActionPhases() throws Exception
   {

      HtmlPage firstPage = getWebClient("/action").getPage();

      // reload so we get a postback that visits all the phases
      HtmlPage secondPage = firstPage.getHtmlElementById("form:reload").click();

      String secondPageContent = secondPage.getWebResponse().getContentAsString();
      assertContains(secondPageContent, "Default = [true]");
      assertContains(secondPageContent, "Ignore Postback = [false]");

   }
View Full Code Here

   }

   @Test
   public void testJavaScriptNotRewritten() throws Exception
   {
      HtmlPage page = getWebClient("/faces/outbound.xhtml").getPage();
      DomElement link = page.getElementById("javascript");
      assertEquals("javascript:void(0)", link.getAttribute("href"));
   }
View Full Code Here

   }

   @Test
   public void testAnchorNotRewritten() throws Exception
   {
      HtmlPage page = getWebClient("/faces/outbound.xhtml").getPage();
      DomElement link = page.getElementById("anchor");
      assertEquals("#foobar", link.getAttribute("href"));
   }
View Full Code Here

   }

   @Test
   public void testEmptyAnchorNotRewritten() throws Exception
   {
      HtmlPage page = getWebClient("/faces/outbound.xhtml").getPage();
      DomElement link = page.getElementById("emptyAnchor");
      assertEquals("#", link.getAttribute("href"));
   }
View Full Code Here

   }

   @Test
   public void testResourceUrlRewritten() throws Exception
   {
      HtmlPage page = getWebClient("/outbound").getPage();
      DomNodeList<DomElement> stylesheets = page.getElementsByTagName("link");
      assertEquals(1, stylesheets.size());
      Assert.assertTrue(stylesheets.get(0).getAttribute("href").contains("/css/style.css"));
      Assert.assertTrue(stylesheets.get(0).getAttribute("href").contains("?ln=test"));
   }
View Full Code Here

   }

   @Test
   public void testOutboundHrefUnmodified() throws Exception
   {
      HtmlPage firstPage = getWebClient("/outbound").getPage();
      String firstPageContent = firstPage.getWebResponse().getContentAsString();
      assertContains(firstPageContent, "href=\"javascript:void(0)\"");
   }
View Full Code Here

   }

   @Test
   public void testHCommandLink() throws Exception
   {
      HtmlPage firstPage = getWebClient("/index").getPage();
      HtmlPage secondPage = firstPage.getHtmlElementById("hCommandLink").click();
      assertThat(secondPage.getUrl().toString(), endsWith("/view-hardcoded-params"));
   }
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.