Skip to content

BrowserFrame

David Ortner edited this page Jan 17, 2025 · 8 revisions

BrowserFrame represents a browser frame.

Signature

class BrowserFrame implements IBrowserFrame

Example

import { Browser } from "happy-dom";

const browser = new Browser();
const page = browser.newPage();

page.mainFrame.url = "https://example.com";

Properties

Property Modifiers Type Description
childFrames readonly BrowserFrame[] Child frames.
parentFrame readonly BrowserFrame | null Parent frame.
page readonly BrowserPage Owner page.
window readonly BrowserWindow Window instance associated with the frame.
document readonly Document Document instance associated with the frame.
content string Set or get the Document content HTML.
url string Set or get the Window URL without navigating the page.

Methods

Method Return type Description
waitUntilComplete() Promise<void> Waits for all ongoing operations to complete. This includes operations such as loading resources and executing scripts.
waitForNavigation() Promise<void> Waits for the page to be navigated after a link has been clicked or the page is redirected by a script. This is resolved when the HTML of the new URL has been loaded into the main frame.
abort() Promise<void> Aborts all ongoing operations.
evaluate() any Evaluates code or a VM Script in the frame's context.
goto() Promise<IResponse | null> Navigates the frame to a URL. The promise is resolved after the content has been loaded into the window.
reload() Promise<IResponse | null> Reloads the frame.
Clone this wiki locally