playwright.chromium, playwright.firefox, or playwright.webkit.
Inheritance
Extends:ChannelOwner
Methods
executablePath
Returns the path to the browser executable.string - Path to the browser executable
Throws: Error if the browser is not supported on the current platform
name
Returns the browser name.string - Browser name (‘chromium’, ‘firefox’, or ‘webkit’)
launch
Launches a new browser instance.Launch configuration options
headless(boolean): Whether to run in headless mode (default: true)executablePath(string): Path to browser executableargs(string[]): Additional arguments to pass to the browserignoreDefaultArgs(boolean | string[]): Ignore default argumentschannel(string): Browser channel to useenv(object): Environment variablesslowMo(number): Slows down operations by specified millisecondstimeout(number): Maximum time in milliseconds to wait for browser to startlogger(Logger): Logger instance
Promise<Browser> - Browser instance
launchPersistentContext
Launches browser with persistent storage.Path to user data directory for persistent storage
Launch options combined with context options
Promise<BrowserContext> - Browser context with persistent storage
connect
Connects to a running browser instance.Connection options
wsEndpoint(string): WebSocket endpoint to connect totimeout(number): Maximum time to wait for connectionslowMo(number): Slows down operations by specified millisecondsheaders(object): Additional HTTP headerslogger(Logger): Logger instance
Promise<Browser> - Connected browser instance
connectOverCDP
Connects to a browser over Chrome DevTools Protocol.CDP endpoint URL (ws:// or http://)
CDP connection options
timeout(number): Connection timeoutslowMo(number): Slow down operationsheaders(object): Additional headerslogger(Logger): Logger instance
Promise<Browser> - Connected browser
Note: Only supported for Chromium browsers
launchServer
Launches a browser server.Server launch options
Promise<BrowserServer> - Browser server instance
Usage Examples
Launch Browser
Connect to Remote Browser
Launch with Persistent Context
Connect Over CDP
Related Classes
- Browser - Browser instance
- BrowserContext - Browser context
- Playwright - Main entry point
