Readonly Internal_The underlying Playwright Locator instance.
ReadonlyallReturns an array of locators pointing to the matched elements.
ReadonlyallGets all inner texts.
ReadonlyallGets all text contents.
ReadonlyandCreates a locator that matches both this locator and the argument locator.
ReadonlyariaReturns the accessibility tree snapshot.
ReadonlyblurRemoves keyboard focus from the current element.
ReadonlyboundingReturns the bounding box of the element.
ReadonlycheckChecks the element.
ReadonlyclearClear the input field.
ReadonlyclickClicks the element.
ReadonlycontentReturns a FrameLocator object pointing to the same iframe as this locator.
ReadonlycountCounts the number of matched elements.
ReadonlydblclickDouble-clicks the element.
ReadonlydescribeDescribes the locator.
ReadonlydescriptionReturns the description of the locator.
ReadonlydispatchDispatches an event.
ReadonlydragDrags the locator to another target locator.
ReadonlydropDrops the locator.
ReadonlyelementResolves given locator to the first matching DOM element.
ReadonlyelementResolves given locator to all matching DOM elements.
ReadonlyevaluateEvaluates a function on the matched element.
Example (Evaluating the matched element)
import { Effect } from "effect";
import { Playwright } from "effect-playwright";
const buttonContent = Effect.gen(function* () {
const page = yield* Playwright.Page;
const locator = page.locator("button");
return yield* locator.evaluate((button) => button.textContent);
});
ReadonlyevaluateEvaluates a function on all matched elements.
ReadonlyevaluateEvaluates a function on the matched element and returns the result as a handle.
ReadonlyfillFills the input field.
ReadonlyfilterNarrows existing locator according to the options.
ReadonlyfirstReturns a locator that points to the first matched element.
ReadonlyfocusFocuses the element.
ReadonlyframeCreates a frame locator that will enter the iframe and allow selecting elements in that iframe.
ReadonlygetGets an attribute value.
ReadonlygetAllows locating elements by their alt text.
ReadonlygetAllows locating elements by their label text.
ReadonlygetAllows locating elements by their placeholder text.
ReadonlygetAllows locating elements by their ARIA role, ARIA attributes and accessible name.
ReadonlygetAllows locating elements by their test id.
ReadonlygetAllows locating elements that contain given text.
ReadonlygetAllows locating elements by their title attribute.
ReadonlyhideHides the element highlight previously added by highlight.
ReadonlyhighlightHighlights the corresponding element(s) on the screen.
ReadonlyhoverHovers over the element.
ReadonlyinnerGets the inner HTML.
ReadonlyinnerGets the inner text.
ReadonlyinputGets the input value.
ReadonlyisReturns whether the element is checked.
ReadonlyisReturns whether the element is disabled.
ReadonlyisReturns whether the element is editable.
ReadonlyisReturns whether the element is enabled.
ReadonlyisReturns whether the element is hidden.
ReadonlyisReturns whether the element is visible.
ReadonlylastReturns a locator that points to the last matched element.
ReadonlylocatorReturns a locator that points to a matched element.
ReadonlynormalizeNormalizes the locator.
ReadonlynthReturns a locator that points to the nth matched element.
ReadonlyorCreates a locator that matches either this locator or the argument locator.
ReadonlypageA page this locator belongs to.
ReadonlypressFocuses the element, and then uses keyboard.down and keyboard.up.
ReadonlypressFocuses the element, and then sends a keydown, keypress/input, and keyup event for each character in the text.
ReadonlyscreenshotCaptures a screenshot of the element.
ReadonlyscrollScrolls the element into view if needed.
ReadonlyselectSelects an option in a <select> element.
ReadonlyselectSelects text.
ReadonlysetChecks the element if not already checked.
ReadonlysetSets the value of the file input.
ReadonlytapTaps the element.
ReadonlytextGets the text content.
ReadonlytoReturns the string representation of the locator.
ReadonlyuncheckUnchecks the element.
ReadonlyuseRuns an asynchronous operation against the underlying Playwright Locator.
When to use
Use this escape hatch only when Locator does not expose the native Playwright operation you need.
Gotchas
The callback must return a Promise. Prefer the wrapper API so Playwright
failures remain represented by the documented wrapper operations.
A function that receives the native locator and returns a promise.
An effect that maps a rejected promise to PlaywrightError.
ReadonlywaitReturns when element specified by locator satisfies the state option.
ReadonlywaitReturns when the matched element satisfies the provided predicate.
import { chromium } from "@playwright/test";
import { Effect } from "effect";
import { Playwright, PlaywrightSpawner } from "effect-playwright";
const program = Effect.gen(function* () {
const browser = yield* Playwright.Browser;
const page = yield* browser.newPage();
yield* page.setContent('<div id="status">Ready</div>');
yield* page.locator("#status").waitForFunction(
(element, expected) => element.textContent === expected,
"Ready",
);
}).pipe(
PlaywrightSpawner.withBrowser,
Effect.provide(PlaywrightSpawner.layer(chromium)),
);
Effect-friendly operations for a Playwright locator.
When to use
Use locators for resilient element selection, interaction, assertions, and browser-side evaluation. Locator-producing operations are synchronous; operations that query or interact with the page return
Effect.Since
0.1.0