new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Playwright · API reference · all subjects

browser

20 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Browser class overview

The Browser class is created via BrowserType.launch. It represents a browser instance that can have multiple contexts and pages.

Browser creation example

Example of creating and using a Browser: const { firefox } = require('playwright'); (async () => { const browser = await firefox.launch(); const page = await browser.newPage(); await page.goto('https://example.com'); await browser.close(); })();

browser-option-ignoredefaultargs for JS and Python

The ignoreDefaultArgs parameter accepts boolean or Array<string>. If true, Playwright does not pass own config args, only uses ones from args option. If array, filters out given default arguments. Dangerous option; use with care. Defaults to false.

csharp-java-browser-option-ignoredefaultargs and ignoreAllDefaultArgs

For C# and Java: ignoreDefaultArgs accepts Array<string> to filter default arguments. ignoreAllDefaultArgs accepts boolean; if true, Playwright does not pass own config args, only uses ones from args option. Dangerous option; use with care. Defaults to false.

browser-option-proxy: Proxy configuration

The proxy parameter is type Object (alias: Proxy) with: server (string, required), HTTP/SOCKS proxy for all requests like http://myproxy.com:3128 or socks5://myproxy.com:3128; bypass (optional string, comma-separated domains to bypass); username (optional string for auth); password (optional string for auth).

browser-option-env for different languages

JS: env is Object<string, string|undefined>. Java/C#: env is Object<string, string>. Python: env is Object<string, string|float|boolean>. Specifies environment variables visible to browser. Defaults to process.env.

browser-option-args: custom browser arguments

The args parameter is Array<string>. Additional arguments for browser instance. Chromium flags reference: https://peter.sh/experiments/chromium-command-line-switches/. Warning: custom args may break Playwright functionality.

browser-option-channel: browser distribution channel

The channel parameter is type string. Browser distribution channel. 'chromium' opts into new headless mode. 'chrome', 'chrome-beta', 'chrome-dev', 'chrome-canary', 'msedge', 'msedge-beta', 'msedge-dev', 'msedge-canary' for branded Google Chrome and Microsoft Edge.

browser-option-chromiumsandbox

The chromiumSandbox parameter is type boolean. Enable Chromium sandboxing. Defaults to false.

browser-option-downloadspath

The downloadsPath parameter is type path. If specified, accepted downloads saved to directory. Otherwise temporary directory created and deleted on browser close. Downloads deleted when context closes.

browser-option-executablepath

The executablePath parameter is type path. Path to browser executable. If relative, resolved relative to current directory. Playwright only works with bundled Chromium, Firefox, WebKit; use at own risk.

browser-option-handlesignals

handleSIGINT (boolean): close on Ctrl-C, defaults true. handleSIGTERM (boolean): close on SIGTERM, defaults true. handleSIGHUP (boolean): close on SIGHUP, defaults true.

browser-option-headless

The headless parameter is type boolean. Whether to run browser in headless mode. Chromium and Firefox docs available. Defaults to true.

js-python-browser-option-firefoxuserprefs

The firefoxUserPrefs parameter is Object<string, string|float|boolean> (JS) or Object<string, string|float|boolean> (Python). Firefox user preferences at about:config. Custom policies.json via PLAYWRIGHT_FIREFOX_POLICIES_JSON environment variable.

csharp-java-browser-option-firefoxuserprefs

The firefoxUserPrefs parameter is Object<string, any> (C# and Java). Firefox user preferences at about:config. Custom policies.json via PLAYWRIGHT_FIREFOX_POLICIES_JSON environment variable.

browser-option-logger deprecated for JS

The logger parameter is type Logger. Logger sink for Playwright logging. Deprecated: logs incomplete, use tracing instead.

browser-option-timeout

The timeout parameter is type float. Maximum time in milliseconds to wait for browser start. Defaults to 30000 (30 seconds). Pass 0 to disable.

browser-option-artifactsdir

The artifactsDir parameter is type path. If specified, artifacts (traces, videos, downloads, HAR) saved to directory. Not cleaned on close. If not specified, temporary directory created and cleaned.

browser-option-tracesdir

The tracesDir parameter is type path. If specified, traces saved to directory.

browser-option-slowmo

The slowMo parameter is type float. Slows down Playwright operations by specified milliseconds. Useful for seeing what happens.

Give your agent this brain