FuckTheWorld / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

cookies' httponly attribute is not returned #1142

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
chromedriver does return httponly cookies but doesn't return httponly attribute 
of those

Original issue reported on code.google.com by vlotoshn...@gmail.com on 1 Jul 2015 at 11:49

GoogleCodeExporter commented 9 years ago
Issue is reproducible with both Chromedriver and FirefoxDriver

isHttpOnly() returns false for a httponly cookie

Below is the sample code:-

    WebDriver driver = new ChromeDriver();
//  WebDriver driver = new FirefoxDriver();
    driver.get("http://gmail.com");

        // it retrieves the cookies including the httponly cookies but returns false
        Set<Cookie> allCookies = driver.manage().getCookies();
    for (Cookie loadedCookie : allCookies) {
        System.out.println(String.format("Name :: %s Value::%s Domain:: %s Path:: %s Expiry:: %s Secure:: %s isHTTPOnly %s ", loadedCookie.getName(), loadedCookie.getValue(), loadedCookie.getDomain(), loadedCookie.getPath(), loadedCookie.getExpiry(), loadedCookie.isSecure(), loadedCookie.isHttpOnly()));    }

       // another way is to create httponly cookie and check for the attribute. This also returns false even though httponly is assigned true.
       long year = TimeUnit.MILLISECONDS.convert(365, TimeUnit.DAYS);
       Date expiry = new Date(System.currentTimeMillis() + year);
       Boolean secure = true;
       Boolean httpOnly = true;
       Cookie cookie = new Cookie("key", "value", ".google.com", "/", expiry, secure, httpOnly);
       driver.manage().addCookie(cookie);

Original comment by gmanikp...@chromium.org on 6 Jul 2015 at 10:55

GoogleCodeExporter commented 9 years ago

Original comment by gmanikp...@chromium.org on 6 Jul 2015 at 10:56

GoogleCodeExporter commented 9 years ago
(FirefoxDriver *might* have been fixed by 
https://github.com/SeleniumHQ/selenium/commit/03587eaa3d5806841254a3c043b15eea9a
19c7c5 followed by 
https://github.com/SeleniumHQ/selenium/commit/e7b941484a8d23fc74eaaa663672795c25
7fa4f9 )

Original comment by vlotoshn...@gmail.com on 7 Jul 2015 at 12:42