BrauzerLab
← Back to missions 37 / 50

Assert Attribute

Easy ~150 sec

The navigation panel contains a “Dashboard” link. You need to assert that this link’s href attribute is /dashboard using expect.

Playwright provides a dedicated assertion for checking HTML attributes on elements. This method accepts the attribute name and the expected value as arguments.

The page object is already available. Find the “Dashboard” link and assert its href attribute.

You can locate the link by id, data-testid, or visible text — all are valid.

TASK

Assert an element's attribute.

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

test('Assert Attribute', async ({ page }) => {
  await page.goto('https://lab.local/mission/have-attribute');
  // ↓ Your code goes below ↓
});
Editor
https://lab.local/mission/have-attribute
Loading...
Results will appear here — press Run or Check.