Basics
Guides
API Reference
Basics
Guides
API Reference
[10:14] (extern: com.lehman.aussom.ABrowserContext) extends: object
The browsercontext class represents an isolated browser session with its own cookies, local storage, and permissions. Instances are obtained by calling browser.newContext() or browsertype.launchPersistentContext(). Each context is independent - cookies and auth state do not leak between contexts.
newPage ()
Creates a new page within this browser context.
A new page object.pages ()
Returns a list of all open pages in this browser context.
A list of page objects.close ()
Closes this browser context and all pages within it.
This object.browser ()
Returns the browser that owns this context.
A browser object, or null if created outside of a browser (e.g. persistent context).cookies (string Url = "")
Returns cookies for the given URL, or all cookies if no URL is provided.
Url is an optional string URL to filter cookies by.A list of cookie maps with keys: name, value, domain, path, expires, httpOnly, secure, sameSite.addCookies (list Cookies)
Adds cookies to this browser context. Affects all pages within the context. Each cookie map should include: name, value, and at least one of url or domain/path.
Cookies is a list of cookie maps.This object.clearCookies ()
Removes all cookies from this browser context.
This object.grantPermissions (list Permissions, string Origin = "")
Grants the specified browser permissions to the given origin.
Permissions is a list of permission strings such as 'geolocation', 'camera', 'microphone', 'notifications'.Origin is an optional string URL origin to grant permissions to.This object.clearPermissions ()
Resets all permission overrides for this browser context.
This object.setGeolocation (double Latitude, double Longitude, double Accuracy = 0.0)
Overrides the geolocation for all pages in this browser context.
Latitude is a double with the latitude coordinate.Longitude is a double with the longitude coordinate.Accuracy is a double with the optional accuracy in meters (default 0.0).This object.setOffline (bool Offline)
Enables or disables offline network emulation for this context.
Offline is a bool - true to simulate an offline network.This object.storageState ()
Serializes the current cookies, localStorage, and IndexedDB state to a JSON string. Useful for saving and restoring authenticated sessions.
A string containing the JSON serialized storage state.setDefaultTimeout (double Timeout)
Sets the default timeout in milliseconds for all action methods on pages within this context. This overrides the Playwright default of 30000ms.
Timeout is a double with the timeout in milliseconds.This object.setDefaultNavigationTimeout (double Timeout)
Sets the default navigation timeout in milliseconds for all pages within this context. This overrides the Playwright default of 30000ms.
Timeout is a double with the timeout in milliseconds.This object.setExtraHTTPHeaders (map Headers)
Attaches extra HTTP headers that will be sent with every network request made from pages within this context.
Headers is a map of header name to header value strings.This object.addInitScript (string Script)
Injects a JavaScript script into every new page and frame within this context before any other scripts execute.
Script is a string of JavaScript source code to inject.This object.waitForPage ()
Waits for a new page to be created within this context and returns it. Useful when an action (e.g. clicking a link) opens a new tab.
A new page object.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.