PlaywrightPHP

Locators

Selectors and locators

Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent a way to find element(s) on the page at any moment.

Basic Locators

Locate by title

$element = $page->getByTitle('My Page Title');

Locate label

$element = $page->getByLabel('My Label');

Locate by placeholder

$element = $page->getByPlaceholder('My Placeholder');
 
$element->fill('My New Value');

Checkout the official documentation for more details.

On this page