-
-
Notifications
You must be signed in to change notification settings - Fork 261
BrowserFrame
David Ortner edited this page Sep 23, 2025
·
11 revisions
BrowserFrame represents a browser frame.
class BrowserFrame implements IBrowserFrame| 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. |
| 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<Response | null> | Navigates the frame to a URL. The promise is resolved after the content has been loaded into the window. |
| goBack() | Promise<Response | null> | Navigates back in the frame's history. The promise is resolved after the content has been loaded into the window. |
| goForward() | Promise<Response | null> | Navigates forward in the frame's history. The promise is resolved after the content has been loaded into the window. |
| goSteps() | Promise<Response | null> | Navigates in the frame's history by a number of steps. The promise is resolved after the content has been loaded into the window. |
| reload() | Promise<Response | null> | Reloads the frame. |
import { Browser } from "happy-dom";
const browser = new Browser();
const page = browser.newPage();
page.mainFrame.url = "https://example.com";
Help Packages