Reputation: 120
I am running Selenium tests in two ways:
The backend creates HttpOnly cookies. I want to check their existence. To get a specific cookie I use the following code:
driver.Manage().Cookies.GetCookieNamed("CookieFooBar");
This works perfectly with the Chrome WebDriver, but does not work with the Chrome Node. Any ideas, what might cause this different behavior?
Upvotes: 1
Views: 1680
Reputation: 120
The answer to this problem is already inside the question itself. As the cookies are HttpOnly cookies, the browser can't track their existence - nevertheless they are still existing. This is actually the reason the HttpOnly flag was created for.
For testing purposes it might be a better approach to test the functionality the cookies should provide instead of simply checking their existence.
I ran the Chrome WebDriver tests without a docker-compose, which I did in the CI-pipeline. That is why the browser was not able to see the HttpOnly cookies.
Upvotes: 1