Interactions

Browser dialogs, mouse and keyboard actions, frames, windows and shadow DOM: the parts of a page that a plain click() and fill() can't handle on their own.

1. JavaScript dialogs

Intermediate

These buttons open the browser's own alert, confirm and prompt boxes, which aren't part of the page.

Result:

Expected: accepting the alert shows You clicked OK on the alert; cancelling the confirm shows You clicked: Cancel; answering the prompt with Mario shows You entered: Mario.

Show me how

2. Modal dialog

Beginner

A real in-page modal (an HTML <dialog>), not a browser dialog.

Choice:

Subscribe to updates?

We will send one email a month.

Expected: the modal opens with its title, clicking Subscribe closes it, and the choice reads Subscribed.

Show me how

3. Drag and drop

Intermediate

Move the tools into the "Selected" box.

Selenium
Playwright
Cypress

Selected

Selected: none

Expected: after dragging all three, the source box is empty, the Selected box holds 3 items, and the summary reads Selenium, Playwright, Cypress.

Show me how

4. Mouse actions

Intermediate

A menu that only appears on hover, a button that needs a double-click, and a custom right-click menu.

Right-click here

Last action:

Expected: choosing Settings from the hover menu shows Menu: Settings; the double-click shows Double click; right-click → Rename shows Context menu: Rename.

Show me how

5. Keyboard

Beginner

You pressed:

Expected: pressing Enter shows Enter, Escape shows Escape, and Ctrl+A shows Ctrl+a (modifiers come first).

Show me how

6. iframe

Intermediate

The form below lives in a separate document inside an iframe.

Message from frame:

Expected: sending Hello from Playwright shows Sent: Hello from Playwright inside the frame, and the same message appears on the main page.

Show me how

7. Tabs & windows

Advanced
Open in new tab

Expected: both open a new page whose heading is Inside the frame. Your test works in the new page, closes it, and carries on in the original one.

Show me how

8. Shadow DOM

Advanced

The input and button below live inside an open shadow root, hidden from document.querySelector.

Expected: typing Mario and pressing Greet shows Hello, Mario!; with an empty name it shows Hello, stranger!

Show me how