Skip to content

Browser

David Ortner edited this page Jan 11, 2024 · 27 revisions

Browser class

Browser represents a Happy DOM Browser instance.

Signature

class Browser implements IBrowser

Example

const browser = new Browser();
const page = browser.newPage();
await page.goto('https://github.com/capricorn86');
await browser.close();

Properties

Property Modifiers Type Description
contexts readonly BrowserContext[] A list of browser contexts. Defaults to one main context.
defaultContext readonly BrowserContext Default context.
settings readonly IBrowserSettings Settings object. The settings can be modified runtime.
console readonly Console null

Methods

Method Description
close() Closes the browser
waitUntilComplete() Waits until all ongoing processes are complete. This includes async tasks such as scripts and resources in loaded pages.
abort() Aborts all ongoing operations.
newIncognitoContext() Creates a new incognito context.
newPage() Creates a new page.
Clone this wiki locally