Skip to main content

Cookies · SetCookies · ClearCookies

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Read, set or clear the current WebView's cookies — the ones its page's URL is sent, HttpOnly ones included, which document.cookie cannot see. These call app_cookies.

Cookies​

public IList<IDictionary<string, object?>> Cookies()

The current WebView's cookies: the ones its page's URL is sent, HttpOnly ones included. Needs a web context — Context first. Each has Vibium's keys: name, value, domain, path, expires (seconds since the epoch, absent for a session cookie), httpOnly, secure and sameSite.

SetCookies​

public void SetCookies(IEnumerable<IDictionary<string, object?>> cookies)

Sets each cookie on the current page and reads the store back, so one the browser accepted and stored expired throws NotConfirmedException.

ClearCookies​

public void ClearCookies(string? name = null)

Deletes the current page's cookies, or only those called name.

Examples​

Read the WebView's cookies​

foreach (var cookie in device.Cookies())
Console.WriteLine($"{cookie["name"]} = {cookie["value"]}");

The same call from the command line, mobium cookies, printed on an Android 15 emulator:

no cookies for about:blank

mobium cookies on an Android 15 emulator

mobium cookies on an Android 15 emulator

device.ClearCookies("session");