Skip to content

DevTools SetCookie support #3218

Closed
Closed
@mitchcapper

Description

@mitchcapper

the cef SetCookie support is limited not supporting things like SameSite settings. DevTools does not have this problem.

Do we want to start a dev tools extension class? I can submit a PR but here is setCookie working:

public enum CookieSameSite { None, Strict, Lax }

		public async Task<bool> SetCookie(String name, String value, String domain, long? expires = null, bool secure = false, bool httpOnly = false, String path = "", CookieSameSite same_site = CookieSameSite.None) {
			var res = await browser.ExecuteDevToolsMethodAsync(0, "Network.setCookie", new Dictionary<string, object> {
				{ "name", name}, { "value", value}, { "domain",domain}, { "expires", expires },
				{ "secure", secure },{ "httpOnly", httpOnly },{ "path",path ?? ""},{"sameSite",same_site.ToString()}
			});
			return res != 0;
		}
		public Task<bool> SetCookie(String name, String value, String domain, DateTimeOffset? expires = null, bool secure = false, bool httpOnly = false, String path = "", CookieSameSite same_site = CookieSameSite.None) => SetCookie(name, value, domain, expires?.ToUnixTimeSeconds(), secure, httpOnly, path, same_site);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions