Selecting one option from a group

Radios are a group

Radio buttons with the same name form a group, and only one can be selected. Selecting one deselects the others. A good test asserts both.

const firefox = page.getByRole('radio', { name: 'Firefox' });

await firefox.check();

await expect(firefox).toBeChecked();
await expect(page.getByRole('radio', { name: 'Chrome' })).not.toBeChecked();

You cannot uncheck a radio

A user can only deselect a radio by choosing another one, so Playwright's uncheck() throws an error on radio buttons. Select a different option instead.

Disabled options

await expect(page.getByRole('radio', { name: 'Internet Explorer' })).toBeDisabled();

Select your browser

Selected browser: none