Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🚀 Feature]: Use dedicated WebDriver Spec endpoint to get named cookie #15044

Open
nvborisenko opened this issue Jan 7, 2025 · 8 comments · May be fixed by #15092
Open

[🚀 Feature]: Use dedicated WebDriver Spec endpoint to get named cookie #15044

nvborisenko opened this issue Jan 7, 2025 · 8 comments · May be fixed by #15092

Comments

@nvborisenko
Copy link
Member

nvborisenko commented Jan 7, 2025

Feature and motivation

Problem: To get cookie by name we fetch all cookies and then filter them out internally.

Spec: https://www.w3.org/TR/webdriver2/#get-named-cookie

Usage example

C#:

driver.Manage().Cookies.GetCookieNamed("abc");

Solution

This method should send GET /session/{sessionId}/cookie/{name} request. {name} is not null or empty, otherwise remote end returns the list of all cookies.

Copy link

github-actions bot commented Jan 7, 2025

@nvborisenko, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@nvborisenko
Copy link
Member Author

.Net part is done.

@navin772
Copy link
Contributor

Python implementation is already done, refer here and here.
So, we can remove the C-py label.

cc: @AutomatedTester

@harsha509
Copy link
Member

This functionality has already been implemented in JS bindings

[cmd.Name.GET_COOKIE, get('/session/:sessionId/cookie/:name')],

@nvborisenko
Copy link
Member Author

@navin772 @harsha509 please double check how it works with empty name as input with Firefox.

Let's say:

driver.Manage().Cookies.GetCookieNamed("   ");

Why: it sends GET request to /session/:sessionId/cookie/ and Firefox returns all cookies. Chrome returns no such cookie.

@navin772
Copy link
Contributor

Thanks for the info @nvborisenko, verified with Chrome and Firefox and the above is correct. I will implement this in Python.

@pallavigitwork
Copy link
Member

I would like to contribute to this and do for Ruby.

@aguspe
Copy link
Contributor

aguspe commented Jan 16, 2025

I would like to contribute to this and do for Ruby.

Thank you for the help Pallavi, this is already implemented in Ruby

@aguspe aguspe removed the C-rb label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@harsha509 @nvborisenko @aguspe @pallavigitwork @navin772 and others