Skip to content

BrowserFrame

David Ortner edited this page Apr 19, 2024 · 5 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. 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> Navigate to a URL.
reload() Promise<IResponse | null> Reloads the frame.
Clone this wiki locally