Skip to main content
Locate an element using a CSS/XPath selector, an AI prompt, or both. When called with a prompt parameter, returns an AILocator - a lazy Playwright Locator that resolves the element’s position via AI on first use.
When called with only a selector (no prompt), page.locator(selector) behaves exactly like the standard Playwright page.locator(selector) - no AI is involved.
Returns Locator - standard Playwright Locator when only a selector is given, or AILocator when a prompt is provided.

AILocator

When prompt is provided, the returned AILocator supports all standard Playwright Locator methods:
  • Actions: click(), fill(), type(), select_option(), check(), uncheck(), clear(), hover(), focus(), press()
  • Queries: text_content(), inner_text(), inner_html(), get_attribute(), input_value(), count()
  • State: is_visible(), is_hidden(), is_enabled(), is_disabled(), is_editable(), is_checked()
  • Chaining: first(), last(), nth(), filter(), locator(), get_by_text(), get_by_role(), get_by_label(), get_by_placeholder()
  • Utilities: wait_for(), screenshot(), playwright_locator (access raw Locator)