BrauzerLab
← Back to missions 30 / 50

`exact: true` — Exact Text Match

Easy ~120 sec

The product management page has two buttons: Add and Add new. Your job is to click only the Add button.

getByText('Add') can match both buttons, because the string 'Add new' contains 'Add' as a substring. Exact matching ({ exact: true }) accepts only a full, character-for-character match.

page is ready and the DOM contains both buttons. id, data-testid, or exact matching — any correct approach passes the mission.

There are multiple valid approaches — getByText(..., { exact: true }), locator('#id'), and getByTestId all work.

TASK

Select the button with the exact matching text.

Provided for you
import { test, expect } from '@playwright/test';

test('`exact: true` — Exact Text Match', async ({ page }) => {
  await page.goto('https://lab.local/mission/exact-match');
  // ↓ Your code goes below ↓
});
Editor
https://lab.local/mission/exact-match
Loading...
Results will appear here — press Run or Check.