Package org.openqa.selenium

Examples of org.openqa.selenium.Cookie


        }
        WebDriver.Options manage = webDriver.manage();
        Site site = task.getSite();
        if (site.getCookies() != null) {
            for (Map.Entry<String, String> cookieEntry : site.getCookies().entrySet()) {
                Cookie cookie = new Cookie(cookieEntry.getKey(), cookieEntry.getValue());
                manage.addCookie(cookie);
            }
        }
        WebElement webElement = webDriver.findElement(By.xpath("/html"));
        String content = webElement.getAttribute("outerHTML");
View Full Code Here


   
    System.out.println(dr.manage().getCookies());
   
    dr.manage().deleteAllCookies();
   
    Cookie c1 = new Cookie("BAIDUID", "xxxxxxxxxx");
    Cookie c2 = new Cookie("BDUSS", "xxxxxxxxxx");
    dr.manage().addCookie(c1);
    dr.manage().addCookie(c2);
   
    System.out.println("browser will be close");
   
View Full Code Here

    @Test
    public void shouldReadCookiesFromRequest() {
        WebDriver webDriver = new JerseyClientHtmlunitDriver(client);
        webDriver.get("http://localhost");
        webDriver.manage().addCookie(new Cookie("cookieone", "valueone", "localhost", "/", null));
        webDriver.get("http://localhost");
        assertThat(webDriver.getTitle(), is("Status"));
        assertThat(webDriver.findElement(By.id("cookie_header.value")).getText(), is("cookieone=valueone;"));
    }
View Full Code Here

    @Test
    public void shouldReadCookiesFromInChildPage() {
        WebDriver webDriver = new JerseyClientHtmlunitDriver(client);
        webDriver.get("http://localhost");
        webDriver.manage().addCookie(new Cookie("cookieone", "valueone", "localhost", "/", null));
        webDriver.get("http://localhost/cookie");
        assertThat(webDriver.getTitle(), is("Cookie"));
        assertThat(webDriver.findElement(By.id("cookie_header.value")).getText(), is("cookieone=valueone;"));
    }
View Full Code Here

    @Test
    public void shouldNotSeeCookieFromDifferentDomain() {
        WebDriver webDriver = new JerseyClientHtmlunitDriver(client);
        webDriver.get("http://localhost");
        webDriver.manage().addCookie(new Cookie("cookieone", "valueone", "localhost", "/", null));
        webDriver.get("http://thoughtworks");
        assertThat(webDriver.getTitle(), is("Status"));
        assertThat(webDriver.findElement(By.id("cookie_header.value")).getText(), is(""));
    }
View Full Code Here

    @Test
    public void shouldNotSeeCookieForDifferentPath() {
        WebDriver webDriver = new JerseyClientHtmlunitDriver(client);
        webDriver.get("http://localhost");
        webDriver.manage().addCookie(new Cookie("cookieone", "valueone", "localhost", "/cookie", null));
        webDriver.get("http://localhost");
        assertThat(webDriver.getTitle(), is("Status"));
        assertThat(webDriver.findElement(By.id("cookie_header.value")).getText(), is(""));
    }
View Full Code Here

            expectedChange.add(new Request("/auraResource", null, null, "js", 200));
        }
        assertRequests(expectedChange, logs);
        assertAppCacheStatus(Status.IDLE);
        // There may be a varying number of requests, depending on when the initial manifest response is received.
        Cookie cookie = getDriver().manage().getCookieNamed(cookieName);
        assertFalse("Manifest cookie was not changed " + cookie.getValue(), "error".equals(cookie.getValue()));
    }
View Full Code Here

          expectedChange.add(new Request(getUrl(), null, null, null, 200));
        }
        assertRequests(expectedChange, logs);
        assertAppCacheStatus(Status.UNCACHED);
        // There may be a varying number of requests, depending on when the initial manifest response is received.
        Cookie cookie = getDriver().manage().getCookieNamed(cookieName);
        assertNull("No manifest cookie should be present", cookie);
    }
View Full Code Here

        assertRequests(getExpectedInitialRequests(), logs);
        assertAppCacheStatus(Status.IDLE);

        Date expiry = new Date(System.currentTimeMillis() + 60000);
        String cookieName = getManifestCookieName();
        Cookie cookie = getDriver().manage().getCookieNamed(cookieName);
        String timeVal = cookie.getValue().split(":")[1];
        updateCookie(cookieName, "8:" + timeVal, expiry, "/");
        logs = loadMonitorAndValidateApp(TOKEN, TOKEN, "", TOKEN);
        List<Request> expectedChange = Lists.newArrayList();

        expectedChange.add(new Request("/auraResource", null, null, "manifest", 404)); // reset
View Full Code Here

    }

    @Given("the value of the session cookie is noted")
    public void findAndSetSessionIds() {
        for (String name : Config.getSessionIDs()) {
            Cookie cookie = app.getCookieByName(name);
            if (cookie != null)
                sessionIds.add(cookie);
        }
    }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.Cookie

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.