Basics
Guides
API Reference
Basics
Guides
API Reference
[10:14] (extern: com.lehman.aussom.ALocator) extends: object
The locator class is the primary element interaction surface in Playwright. It represents a lazy, auto-retrying reference to DOM elements. Instances are obtained by calling page.locator(), page.getByRole(), page.getByText(), and similar factory methods on page or locator objects. Locator methods auto-retry until the element is actionable or a timeout is exceeded.
all ()
Returns a list of locator objects for every element currently matching this locator's selector.
A list of locator objects.count ()
Returns the number of elements currently matching this locator.
An int count of matching elements.first ()
Returns a new locator narrowed to the first matching element.
A locator for the first match.last ()
Returns a new locator narrowed to the last matching element.
A locator for the last match.nth (int Index)
Returns a new locator narrowed to the nth matching element (0-indexed).
Index is an int zero-based index of the element to select.A locator for the nth match.filter (string HasText)
Returns a new locator filtered to elements whose visible text contains the given string.
HasText is a string of text that must be present in the element.A filtered locator.and (object Other)
Returns a new locator that matches elements satisfying both this locator and the given other locator.
Other is a locator to intersect with.A combined locator.or (object Other)
Returns a new locator that matches elements satisfying either this locator or the given other locator.
Other is a locator to union with.A combined locator.newLocator (string Selector)
Returns a new locator scoped to descendants matching the given selector within this locator's matched elements.
Selector is a string CSS or XPath selector.A scoped locator.getByRole (string Role)
Returns a locator for descendants matching the given ARIA role.
Role is a string ARIA role name.A locator.getByText (string Text)
Returns a locator for descendants by visible text.
Text is a string of visible text to match.A locator.getByLabel (string Label)
Returns a locator for form inputs by associated label text within scope.
Label is a string label text to match.A locator.getByPlaceholder (string Placeholder)
Returns a locator for form inputs by placeholder text within scope.
Placeholder is a string placeholder to match.A locator.getByTestId (string TestId)
Returns a locator for elements by test ID within scope.
TestId is a string test ID value.A locator.click ()
Clicks the element. Auto-waits for the element to be actionable.
This object.dblclick ()
Double-clicks the element.
This object.hover ()
Moves the mouse pointer over the element.
This object.tap ()
Taps the element (touch gesture).
This object.fill (string Value)
Clears any existing value and fills the element with the provided text. Works for input, textarea, and contenteditable elements.
Value is a string value to fill.This object.clear ()
Clears the value of an editable element (input, textarea, contenteditable).
This object.pressSequentially (string Text)
Types text character-by-character, triggering keydown, keypress, and keyup events for each character.
Text is a string of text to type sequentially.This object.press (string Key)
Presses a single key or key combination on the element.
Key is a string key name (e.g. 'Enter', 'Tab', 'Control+a').This object.check ()
Checks the element if it is a checkbox or radio button.
This object.uncheck ()
Unchecks the element if it is a checkbox.
This object.setChecked (bool Checked)
Sets the checked state of a checkbox or radio button explicitly.
Checked is a bool - true to check, false to uncheck.This object.selectOption (string Value)
Selects one or more options in a select element by their value strings.
Value is a string option value to select.A list of strings with the selected option values.focus ()
Focuses the element.
This object.blur ()
Removes focus from the element.
This object.dragTo (object Target)
Drags this element to the target locator's element.
Target is a locator object representing the drop target.This object.dispatchEvent (string Type)
Dispatches a DOM event of the given type on the element.
Type is a string DOM event type (e.g. 'click', 'input', 'change').This object.isVisible ()
Returns whether the element is visible.
A bool - true if visible.isHidden ()
Returns whether the element is hidden.
A bool - true if hidden.isEnabled ()
Returns whether the element is enabled.
A bool - true if enabled.isDisabled ()
Returns whether the element is disabled.
A bool - true if disabled.isChecked ()
Returns whether the checkbox or radio button element is checked.
A bool - true if checked.isEditable ()
Returns whether the element is editable (not readonly and not disabled).
A bool - true if editable.boundingBox ()
Returns the bounding box of the element as a map with keys 'x', 'y', 'width', and 'height' in pixels.
A map with double values for x, y, width, height, or null if not visible.getAttribute (string Name)
Returns the value of the named attribute on the element.
Name is a string attribute name.A string attribute value, or null if the attribute does not exist.innerHTML ()
Returns the element.innerHTML of the matched element.
A string with the inner HTML.innerText ()
Returns the element.innerText of the matched element (visible text only).
A string with the inner text.textContent ()
Returns the node.textContent of the matched element (includes hidden text).
A string with the text content.inputValue ()
Returns the current value of an input, textarea, or select element.
A string with the current input value.allInnerTexts ()
Returns the innerText of every element matching this locator.
A list of strings.allTextContents ()
Returns the textContent of every element matching this locator.
A list of strings.evaluate (string Expression)
Evaluates a JavaScript expression with the matched element as the first argument and returns the serialized result.
Expression is a string JavaScript expression (e.g. 'el => el.value').The result of the expression.evaluateAll (string Expression)
Evaluates a JavaScript expression against all matching elements and returns the serialized result.
Expression is a string JavaScript expression (e.g. 'els => els.length').The result of the expression.waitFor (string State = "visible")
Waits for the element to become visible (default state) or to satisfy another state such as 'hidden', 'attached', or 'detached'.
State is a string state to wait for: 'visible', 'hidden', 'attached', 'detached'.This object.screenshot (string Path)
Captures a screenshot of the matched element and saves it to disk.
Path is a string file path where the screenshot will be saved.This object.highlight ()
Highlights the matched element on screen for visual debugging.
This object.page ()
Returns the page that this locator belongs to.
A page object.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.