Basics
Guides
API Reference
Basics
Guides
API Reference
[16:14] (extern: com.lehman.aussom.APage) extends: object
The page class represents a single browser tab. It is the primary surface for all DOM interaction including navigation, content inspection, and element interaction via locators. Instances are obtained by calling browser.newPage() or browsercontext.newPage().
navigate (string Url)
Navigates the page to the given URL.
Url is a string with the URL.A response object for the main resource or null.goBack ()
Navigates back in the browser history.
A response object or null if navigation was not possible.goForward ()
Navigates forward in the browser history.
A response object or null if navigation was not possible.reload ()
Reloads the current page.
A response object for the main resource response.content ()
Returns the full outer HTML of the page including the doctype.
A string with the page HTML content.setContent (string Html)
Sets the full HTML content of the page.
Html is a string with the HTML to set as the page content.This object.title ()
Returns the page title from the document title element.
A string with the page title.url ()
Returns the current URL of the page.
A string with the current page URL.close ()
Closes the page.
This object.isClosed ()
Returns whether the page has been closed.
A bool - true if the page is closed.bringToFront ()
Brings the page to the foreground (activates the tab).
This object.pause ()
Pauses script execution and opens the Playwright Inspector for debugging. Only useful in headed mode.
This object.locator (string Selector)
Creates a locator for elements matching the given CSS or XPath selector.
Selector is a string CSS or XPath selector.A locator object for elements matching the selector.getByRole (string Role)
Creates a locator for elements matching the given ARIA role.
Role is a string ARIA role name (e.g. 'button', 'heading', 'link').A locator object.getByText (string Text)
Creates a locator for elements by their visible text content.
Text is a string of visible text to match.A locator object.getByLabel (string Label)
Creates a locator for form inputs by their associated label text.
Label is a string label text to match.A locator object.getByPlaceholder (string Placeholder)
Creates a locator for form inputs by their placeholder text.
Placeholder is a string placeholder text to match.A locator object.getByAltText (string AltText)
Creates a locator for elements by their alt text attribute.
AltText is a string alt attribute value to match.A locator object.getByTitle (string Title)
Creates a locator for elements by their title attribute.
Title is a string title attribute value to match.A locator object.getByTestId (string TestId)
Creates a locator for elements by their test ID attribute (data-testid by default).
TestId is a string test ID value to match.A locator object.evaluate (string Expression)
Evaluates a JavaScript expression in the page context and returns the result. The expression can be a function body string or an arrow function.
Expression is a string JavaScript expression to evaluate.The serialized result of the expression.addInitScript (string Script)
Injects a JavaScript script to be executed in every new page load before other scripts run.
Script is a string of JavaScript source code.This object.screenshot (string Path)
Captures a screenshot of the visible page area and saves it to disk.
Path is a string file path where the screenshot will be saved (PNG or JPEG).This object.pdf (string Path)
Renders the page to a PDF and saves it to disk. Chromium only.
Path is a string file path where the PDF will be saved.This object.setViewportSize (int Width, int Height)
Sets the page viewport size in pixels.
Width is an int width in pixels.Height is an int height in pixels.This object.viewportSize ()
Returns the current viewport size as a map with 'width' and 'height' keys.
A map with int keys 'width' and 'height'.context ()
Returns the browser context that owns this page.
A browsercontext object.waitForLoadState (string State)
Waits for the page to reach the given load state.
State is a string: 'load', 'domcontentloaded', or 'networkidle'.This object.waitForURL (string Url)
Waits for the page URL to match the given URL string.
Url is a string URL to wait for.This object.waitForTimeout (double Timeout)
Pauses execution for the given number of milliseconds.
Timeout is a double number of milliseconds to wait.This object.waitForFunction (string Expression)
Waits until a JavaScript expression evaluates to truthy.
Expression is a string JavaScript expression to poll.This object.keyboard ()
Returns the keyboard sub-object for low-level keyboard input simulation.
A keyboard object.mouse ()
Returns the mouse sub-object for low-level mouse input simulation.
A mouse object.waitForDialog ()
Waits for a dialog event (alert, confirm, prompt) and returns the dialog object. The action runnable should trigger the dialog.
A dialog object.waitForConsoleMessage ()
Waits for a console message event and returns it.
A consolemessage object.onConsoleMessage (callback OnMessage)
Registers a streaming console-message handler. The provided callback is invoked once per browser console event (log, info, warn, error, debug, dir, trace) from the moment the listener is installed until the page is closed. Complements waitForConsoleMessage, which waits for a single event. Typical use: capture every console line into a test log to surface browser-side errors (including aussom-script c.err output) in Playwright failures.
OnMessage is a callback invoked as OnMessage(consolemessage) per event.This object.onPageError (callback OnError)
Registers a streaming page-error handler. The callback fires once per uncaught JavaScript exception in the page, which includes aussom-script runtime errors that escape catch blocks. Pair with onConsoleMessage to cover every failure the browser reports.
OnError is a callback invoked as OnError(string message).This object.waitForRequest (string Url)
Waits for a network request matching the given URL and returns it.
Url is a string URL pattern to match.A request object.waitForResponse (string Url)
Waits for a network response matching the given URL and returns it.
Url is a string URL pattern to match.A response object.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.