Examples of WebDriver


Examples of org.openqa.selenium.WebDriver

     *
     * @see com.vaadin.tests.tb3.AbstractTB3Test#setupLocalDriver()
     */
    @Override
    protected void setupLocalDriver(DesiredCapabilities desiredCapabilities) {
        WebDriver driver;
        if (BrowserUtil.isFirefox(desiredCapabilities)) {
            String firefoxPath = getProperty("firefox.path");
            if (firefoxPath != null) {
                driver = new FirefoxDriver(new FirefoxBinary(new File(
                        firefoxPath)), null);
View Full Code Here

Examples of org.openqa.selenium.WebDriver

        final int SCROLLTOP = 100;

        openTestURL();

        WebDriver driver = getDriver();

        WebElement ui = driver.findElement(By.className("v-ui"));

        testBenchElement(ui).scroll(SCROLLTOP);

        driver.findElement(By.id("visibility-toggle"))
                .findElement(By.tagName("input")).click();

        assertEquals("UI scroll position", String.valueOf(SCROLLTOP),
                ui.getAttribute("scrollTop"));
    }
View Full Code Here

Examples of org.openqa.selenium.WebDriver

   private java.net.URL baseUrl;

   @Test
   public void testRedirectToUrlWithAnchor() throws Exception
   {
      WebDriver driver = new HtmlUnitDriver();
      driver.get(baseUrl.toString() + "do");
      assertThat(driver.getCurrentUrl()).endsWith("/it#now");
   }
View Full Code Here

Examples of org.openqa.selenium.WebDriver

   @Test
   public void withCookiesAndStandardOutcome() throws Exception
   {

      // GIVEN a browser with cookies enabled
      WebDriver driver = createBrowserAndLoadPage(true);
      assertThat(driver.getPageSource(), Matchers.not(Matchers.containsString("jsessionid")));

      // WHEN a JSF action redirects with a standard outcome
      driver.findElement(By.id("form:standardOutcome")).click();

      // THEN the browser should be redirected
      assertThat(driver.getCurrentUrl(), Matchers.containsString("redirected=true"));

      // AND there should be no jsessionid in the URL
      assertThat(driver.getCurrentUrl(), Matchers.not(Matchers.containsString("jsessionid")));

   }
View Full Code Here

Examples of org.openqa.selenium.WebDriver

   @Test
   public void withCookiesAndNavigateOutcome() throws Exception
   {

      // GIVEN a browser with cookies enabled
      WebDriver driver = createBrowserAndLoadPage(true);
      assertThat(driver.getPageSource(), Matchers.not(Matchers.containsString("jsessionid")));

      // WHEN a JSF action redirects with a standard outcome
      driver.findElement(By.id("form:navigateOutcome")).click();

      // THEN the browser should be redirected
      assertThat(driver.getCurrentUrl(), Matchers.containsString("redirected=true"));

      // AND there should be no jsessionid in the URL
      assertThat(driver.getCurrentUrl(), Matchers.not(Matchers.containsString("jsessionid")));

   }
View Full Code Here

Examples of org.openqa.selenium.WebDriver

   @Test
   public void withoutCookiesAndStandardOutcome() throws Exception
   {

      // GIVEN a browser with cookies disabled
      WebDriver driver = createBrowserAndLoadPage(false);
      assertThat(driver.getPageSource(), Matchers.containsString("jsessionid"));

      // WHEN a JSF action redirects with a standard outcome
      driver.findElement(By.id("form:standardOutcome")).click();

      // THEN the browser should be redirected
      assertThat(driver.getCurrentUrl(), Matchers.containsString("redirected=true"));

      // AND there should be a jsessionid in the URL
      assertThat(driver.getCurrentUrl(), Matchers.containsString("jsessionid"));

   }
View Full Code Here

Examples of org.openqa.selenium.WebDriver

   @Test
   public void withoutCookiesAndNavigateOutcome() throws Exception
   {

      // GIVEN a browser with cookies disabled
      WebDriver driver = createBrowserAndLoadPage(false);
      assertThat(driver.getPageSource(), Matchers.containsString("jsessionid"));

      // WHEN a JSF action redirects with a standard outcome
      driver.findElement(By.id("form:navigateOutcome")).click();

      // THEN the browser should be redirected
      assertThat(driver.getCurrentUrl(), Matchers.containsString("redirected=true"));

      // AND there should be a jsessionid in the URL
      assertThat(driver.getCurrentUrl(), Matchers.containsString("jsessionid"));

   }
View Full Code Here

Examples of org.openqa.selenium.WebDriver

   private WebDriver createBrowserAndLoadPage(final boolean cookies)
   {

      // custom HtmlUnitDriver with cookies enabled or disabled
      WebDriver driver = new HtmlUnitDriver() {
         @Override
         protected WebClient modifyWebClient(WebClient client)
         {
            client.getCookieManager().setCookiesEnabled(cookies);
            return client;
         }
      };

      // load the page twice to get rid of jsessionid if cookies are enabled
      driver.get(baseUrl + "test");
      driver.get(baseUrl + "test");

      return driver;

   }
View Full Code Here

Examples of org.openqa.selenium.WebDriver

               for (int i = 0; i < REQUESTS_PER_THREAD; i++) {

                  String uuid = UUID.randomUUID().toString();

                  WebDriver driver = new HtmlUnitDriver();
                  driver.get(baseUrl + "test/" + uuid + "/");

                  if (driver.getPageSource().contains("The parameter is [" + uuid + "]")) {
                     successCounter.addAndGet(1);
                  }

               }
View Full Code Here

Examples of org.openqa.selenium.WebDriver

      System.out.println("");
    }
  };

  private static WebDriver createDriver (String name) {
    WebDriver driver = null;

    if (name.equals("opera")) {
      DesiredCapabilities cap = DesiredCapabilities.opera();
      cap.setCapability("opera.profile",
          new OperaProfile(System.getProperty("wasavi.tests.opera.profile_path")));
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.