UNPKG

playwright-fluent

Version:
78 lines (77 loc) 2.47 kB
import { Browser } from 'playwright'; export declare type BrowserName = 'chromium' | 'chrome' | 'chrome-canary' | 'firefox' | 'webkit'; export interface LaunchOptions { /** * Whether to run browser in headless mode. * Defaults to true * * @type {boolean} * @memberof LaunchOptions */ headless: boolean; /** * Additional arguments to pass to the browser instance. * The list of Chromium flags can be found at * https://peter.sh/experiments/chromium-command-line-switches/ * * @type {string[]} * @memberof LaunchOptions */ args?: string[]; /** * If specified, accepted downloads are downloaded into this folder. Otherwise, temporary folder is created and is deleted when browser is closed. * * @type {string} * @memberof LaunchOptions */ downloadsPath?: string; /** * Path to a browser executable to run instead of the bundled one. * * @type {string} * @memberof LaunchOptions */ executablePath?: string; /** * Maximum time in milliseconds to wait for the browser instance to start. Defaults to 30000 (30 seconds). Pass 0 to disable timeout. * * @type {number} * @memberof LaunchOptions */ timeout?: number; /** * Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. * * @type {number} * @memberof LaunchOptions */ slowMo?: number; proxy?: { /** * Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example http://myproxy.com:3128 or socks5://myproxy.com:3128. Short form myproxy.com:3128 is considered an HTTP proxy. * * @type {string} */ server: string; /** * coma-separated domains to bypass proxy, for example ".com, chromium.org, .domain.com". * * @type {string} */ bypass?: string; /** * username to use if HTTP proxy requires authentication. * * @type {string} */ username?: string; /** * password to use if HTTP proxy requires authentication. * * @type {string} */ password?: string; }; } export declare const defaultLaunchOptions: LaunchOptions; export declare function launchBrowser(name: BrowserName, options: LaunchOptions): Promise<Browser>;