Package org.openqa.selenium

Examples of org.openqa.selenium.WebDriver.manage()


        assertEquals(d.manage().getCookies().size(), 0);

        // All cookies deleted, call deleteAllCookies again. Should be a no-op.
        d.manage().deleteAllCookies();
        d.manage().deleteCookieNamed("non_existing_cookie");
        assertEquals(d.manage().getCookies().size(), 0);
    }

    @Test
    public void shouldAllowToSetCookieThatIsAlreadyExpired() {
        WebDriver d = getDriver();
View Full Code Here


    public void shouldAllowToSetCookieThatIsAlreadyExpired() {
        WebDriver d = getDriver();
        d.get("https://github.com/");

        // Clear all cookies
        assertTrue(d.manage().getCookies().size() > 0);
        d.manage().deleteAllCookies();
        assertEquals(d.manage().getCookies().size(), 0);

        // Added cookie that expires in the past
        Cookie addedCookie = new Cookie.Builder("expired", "yes")
View Full Code Here

        WebDriver d = getDriver();
        d.get("https://github.com/");

        // Clear all cookies
        assertTrue(d.manage().getCookies().size() > 0);
        d.manage().deleteAllCookies();
        assertEquals(d.manage().getCookies().size(), 0);

        // Added cookie that expires in the past
        Cookie addedCookie = new Cookie.Builder("expired", "yes")
                .expiresOn(new Date(System.currentTimeMillis() - 1000)) //< now - 1 second
View Full Code Here

        d.get("https://github.com/");

        // Clear all cookies
        assertTrue(d.manage().getCookies().size() > 0);
        d.manage().deleteAllCookies();
        assertEquals(d.manage().getCookies().size(), 0);

        // Added cookie that expires in the past
        Cookie addedCookie = new Cookie.Builder("expired", "yes")
                .expiresOn(new Date(System.currentTimeMillis() - 1000)) //< now - 1 second
                .build();
View Full Code Here

        // Added cookie that expires in the past
        Cookie addedCookie = new Cookie.Builder("expired", "yes")
                .expiresOn(new Date(System.currentTimeMillis() - 1000)) //< now - 1 second
                .build();
        d.manage().addCookie(addedCookie);

        Cookie cookie = d.manage().getCookieNamed("expired");
        assertNull(cookie);
    }
View Full Code Here

        Cookie addedCookie = new Cookie.Builder("expired", "yes")
                .expiresOn(new Date(System.currentTimeMillis() - 1000)) //< now - 1 second
                .build();
        d.manage().addCookie(addedCookie);

        Cookie cookie = d.manage().getCookieNamed("expired");
        assertNull(cookie);
    }

    @Test(expected = Exception.class)
    public void shouldThrowExceptionIfAddingCookieBeforeLoadingAnyUrl() {
View Full Code Here

        // ChromeDriver is fine instead.
        String xval = "123456789101112"; //< detro: I buy you a beer if you guess what am I quoting here
        WebDriver d = getDriver();

        // Set cookie, without opening any page: should throw an exception
        d.manage().addCookie(new Cookie("x", xval));
    }

    @Test
    public void shouldBeAbleToCreateCookieViaJavascriptOnGoogle() {
        String ckey = "cookiekey";
View Full Code Here

    }

    public WebDriver webDriver() {
        final WebDriver driver = webDriver(environment.getProperty("selenium.browser"));

        driver.manage().timeouts().implicitlyWait(webDriverWaitTimeout(), TimeUnit.SECONDS);

        driver.manage().window().maximize();

        return driver;
    }
View Full Code Here

    public WebDriver webDriver() {
        final WebDriver driver = webDriver(environment.getProperty("selenium.browser"));

        driver.manage().timeouts().implicitlyWait(webDriverWaitTimeout(), TimeUnit.SECONDS);

        driver.manage().window().maximize();

        return driver;
    }

    private long webDriverWaitTimeout() {
View Full Code Here

 
  @Provides @TestScoped
  WebDriver getWebDriver(@PortNumber int portNumber, TestId testId) {
    WebDriver driver = new HtmlUnitDriver();
    driver.get("http://localhost:" + portNumber);
    driver.manage().addCookie(new Cookie(TestId.COOKIE_NAME, testId.toString()));
    return driver;
  }
 
  @Provides
  @Singleton
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.