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 List<Map<String, Object>> cookies()
The current WebView's cookies: the ones its page's URL is sent, HttpOnly
ones included. Needs a web context -- context(String) first.
Each map has Vibium's keys: name, value, domain, path,
expires (seconds since the epoch, absent for a session cookie),
httpOnly, secure and sameSite.
@return the page's cookies
setCookies
public void setCookies(List<Map<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. Each needs name and value; the rest
default to the page's host, "/" and a session cookie.
@param cookies the cookies, as maps with the keys cookies() answers
clearCookies
public void clearCookies(String... name)
Deletes the current page's cookies, or with a name only those called that.
@param name the cookie to delete; none deletes them all
Examples
Read the WebView's cookies
for (Map<String, Object> cookie : device.cookies()) {
System.out.println(cookie.get("name") + "=" + cookie.get("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
Delete one cookie
device.clearCookies("session");