BrauzerLab
← Back to missions 8 / 50

Locator by Position

Medium ~180 sec

The task list has three items, each with an identical-looking «Delete» button. Instead of distinguishing them by text, id, or data-testid, you need to select by position.

Playwright’s .first(), .last(), .nth() methods let you pick a specific element from a locator result. This is especially useful in dynamic lists.

page is already available. Click the last Delete button in the list.

TASK

Click the last item in the list.

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

test('Locator by Position', async ({ page }) => {
  await page.goto('https://lab.local/mission/nth-first-last');
  // ↓ Your code goes below ↓
});
Editor
https://lab.local/mission/nth-first-last
Loading...
Results will appear here — press Run or Check.