Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ChromeDriver creates two cookies when the cookie to add contains the domain #7499

Closed
lukeis opened this Issue Mar 4, 2016 · 2 comments

Comments

Projects
None yet
1 participant
Owner

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 7499

What steps will reproduce the problem?
1. addCookie where the cookie contains a domain

What is the expected output? What do you see instead?
- expected - only one cookie created
- actual - two cookies created

Selenium version: 2.42.2
OS: Windows 8
Browser: Chrome
Browser version: Version 35.0.1916.153 m

You can find tests which explain and demonstrate the issue on github at...

https://github.com/eviltester/webDriverExperiments/blob/master/src/test/java/com/seleniumsimplified/webdriver/cookies/FirefoxCookiesWorkFineButChromeAddsAdditional.java

Details:

I noticed that when I addCookie using ChromeDriver, sometimes more than one cookie
was added.

This only happens when the domain is part of the cookie.

- if I copy a cookie then two cookies will be created.
- if I create a new cookie and add the domain then two cookies will be created

The additional cookie is of the form below:

ChromeDriverwjers908fljsdf37459fsdfgdfwru=;
path=/selenium;
domain=.compendiumdev.co.uk

I can create this additional cookie when I addCookie using code like the following:

driver.manage().addCookie(
                new Cookie.Builder(aCookie.getName(),
                        aCookie.getValue()).
                        path(aCookie.getPath()).
                        // enable line below to have test fail on chrome
                        domain(aCookie.getDomain()).
                        expiresOn(aCookie.getExpiry()).
                        isHttpOnly(aCookie.isHttpOnly()).
                        isSecure(aCookie.isSecure()).
                        build());

If I do not have the line
   domain(aCookie.getDomain()).

Then only a single cookie is created.





Reported by alan.j.richardson on 2014-06-17 09:39:19

Owner

lukeis commented Mar 4, 2016

Moved to: Issue chromedriver:824

Reported by barancev on 2014-06-17 10:35:19

  • Status changed: Moved

@lukeis lukeis self-assigned this Mar 4, 2016

Owner

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:22:35

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this Mar 4, 2016

@lukeis lukeis locked and limited conversation to collaborators Mar 4, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.