Playwright NotesRohit’s interview study guide
Chapter 05

Actions and Auto-waiting

What Playwright checks before every click and keystroke, how to type, press keys, tick boxes and pick options, how to upload, download and drag, how to handle dialogs, hovers and focus, the few times you really do need to wait for something, and why force: true is almost always a bug in the test. Every test was run with Playwright 1.65.1 against the Practice Shop.

7 topics
Parts marked Advanced are extra depth. Skip them on a first read or a quick revision.

#The actionability checks

Added

Before an action, Playwright doesn't just find the element; it waits until a real user could do that action to it. A person can't click a button that's greyed out, hidden, sliding across the screen or covered by a cookie banner, so Playwright doesn't either. These are the actionability checks, and they're the "auto" in auto-waiting (Chapter 1).

The checks, as the docs define them:

  • Visible: a non-empty bounding box and not visibility: hidden. (opacity: 0 still counts as visible.)
  • Stable: the same bounding box for at least two animation frames in a row, so it isn't mid-animation.
  • Enabled: not disabled, not inside a disabled <fieldset>, not inside an aria-disabled="true" element.
  • Editable: enabled and not readonly.
  • Receives events: the element is what's actually under the pointer at the click point, not an overlay.
  • Not inert (1.65+): not inside an element with the inert attribute.

Not every action needs every check. From the docs' table:

ActionVisibleStableReceives eventsEnabledEditableNot inert
click, dblclick, check, uncheck, setChecked, tap✓✓✓✓✓
hover, dragTo✓✓✓
fill, clear✓✓✓✓
selectOption✓✓✓
screenshot✓✓
focus, press, pressSequentially, setInputFiles, blur, dispatchEvent

The last row matters: press, pressSequentially and setInputFiles wait for the element to exist but check nothing else, because a key press goes to whatever has focus and a file input is usually invisible on purpose.

The mental model: a patient user with a checklist. Before each click they ask "can I see it, has it stopped moving, is it greyed out, is something on top of it?" and wait until every answer is right. If the timeout runs out first, the error's call log says which question kept failing.

tests/actionability.spec.ts
import { test, expect, type Page } from "@playwright/test";

async function signIn(page: Page, path = "/practice/shop") {
  await page.goto(path);
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await expect(page).toHaveURL(path);
}
const addButton = (page: Page, product: string) =>
  page.getByRole("listitem").filter({ hasText: product }).getByRole("button", { name: "Add to cart" });
// The call log is part of the error message (with terminal colour codes). Keep its distinct lines that say what was wrong.
const why = (e: Error) =>
  [...new Set(e.message.replace(/\u001b\[\d+m/g, "").split("\n").map((l) => l.trim()).filter((l) => /^- (element is|<.+> intercepts)/.test(l)))];

test("a disabled button is never clicked", async ({ page }) => {
  await signIn(page);
  const error = await addButton(page, "Vertical Mouse").click({ timeout: 2000 }).catch((e: Error) => e);
  console.log("sold out:", why(error));
  await expect(page.getByRole("link", { name: "Cart (0)" })).toBeVisible();
});

test("a covered button is never clicked", async ({ page }) => {
  await signIn(page);
  await expect(addButton(page, "Wireless Mouse")).toBeEnabled();
  // A full-screen cookie banner, the kind that ships by accident.
  await page.evaluate(() => document.body.insertAdjacentHTML("beforeend", '<div class="cookie-banner" style="position:fixed;inset:0;background:#0008">We use cookies</div>'));
  const error = await addButton(page, "Wireless Mouse").click({ timeout: 2000 }).catch((e: Error) => e);
  console.log("covered:", why(error));
});

test("an inert part of the page can't be clicked or filled (1.65+)", async ({ page }) => {
  await signIn(page);
  await expect(addButton(page, "Wireless Mouse")).toBeEnabled();
  await page.evaluate(() => (document.querySelector("main")!.inert = true)); // what a modal does to the page behind it
  const click = await addButton(page, "Wireless Mouse").click({ timeout: 2000 }).catch((e: Error) => e);
  const fill = await page.getByLabel("Search products").fill("mouse", { timeout: 2000 }).catch((e: Error) => e);
  console.log("inert click:", why(click), "inert fill:", why(fill));
});

test("trial: true runs the checks without acting", async ({ page }) => {
  await signIn(page);
  await addButton(page, "Wireless Mouse").click({ trial: true });
  await expect(page.getByRole("link", { name: "Cart (0)" })).toBeVisible();
});
npx playwright test
Running 4 tests using 1 worker

sold out: [ '- element is not enabled' ]
  ✓  1 [chromium] › tests/actionability.spec.ts:16:1 › a disabled button is never clicked (3.1s)
covered: [
  '- element is visible, enabled and stable',
  '- <div class="cookie-banner">We use cookies</div> intercepts pointer events'
]
  ✓  2 [chromium] › tests/actionability.spec.ts:23:1 › a covered button is never clicked (3.8s)
inert click: [ '- element is inert' ] inert fill: [ '- element is inert' ]
  ✓  3 [chromium] › tests/actionability.spec.ts:32:1 › an inert part of the page can't be clicked or filled (1.65+) (5.9s)
  ✓  4 [chromium] › tests/actionability.spec.ts:41:1 › trial: true runs the checks without acting (1.9s)

  4 passed (15.3s)
What’s happening
  1. why is a small helper for this page: when an action times out, Playwright's error message includes a call log of every attempt (each line wrapped in terminal colour codes, which why strips), and why keeps only its distinct lines that start "element is…" or "… intercepts". In a real failing test you'd read the whole call log in the report.
  2. Disabled. The sold-out Vertical Mouse's button has the disabled attribute. click() finds it at once, then keeps re-checking for 2 seconds and gives up; the reason is "element is not enabled". The cart stays at 0: no click was ever sent.
  3. Covered. The test first waits for the products, then adds a fixed, full-screen banner. The button is visible, enabled and stable (the first line), but the point Playwright would click belongs to the banner, so it reports <div class="cookie-banner">We use cookies</div> intercepts pointer events and retries, scrolling and checking again, until the timeout. A real user couldn't click it either, and that's the point: the test fails exactly when the user would be stuck.
  4. Inert. Setting inert on <main> is what a modal dialog does to the page behind it. Since 1.65, click and fill both wait for "not inert" (the release notes list it as a behaviour change), and both report "element is inert". A user can't reach anything behind an open modal, and now neither can the test.
  5. Trial. click({ trial: true }) waits for every check to pass and then doesn't click. The cart stays at 0. It's handy for "wait until this is clickable" without side effects, for example before taking a screenshot.
AdvancedWhich timeout an action uses

Actions have no timeout of their own by default: actionTimeout is 0, so an action waits until the test times out (30 seconds by default). That's why a stuck click often shows up as "Test timeout of 30000ms exceeded" rather than an action timeout. Set use: { actionTimeout: 10_000 } in the config to get a clearer error sooner, or pass { timeout } to one action, as the tests above do. Navigations have navigationTimeout the same way. Assertions are different: they default to 5 seconds (Chapter 6).

#Clicking, typing and keys

Added

Most tests are a handful of these. Each one is "do what a user does, after the checks above":

  • click(): a real mouse click (move, press, release) at the element's centre. dblclick(), click({ button: "right" }) and click({ modifiers: ["Shift"] }) cover the variations.
  • fill(text): focuses the field and sets its whole value at once, firing one input event, like pasting. The docs' advice: use fill for almost everything.
  • pressSequentially(text): types one key at a time (a keydown, keypress, input and keyup per character), optionally with { delay } between keys. Use it only when the page reacts to individual keys: an input mask, a type-ahead that listens for keyup, a game.
  • press(key): one key or shortcut, like "Enter", "Escape", "ArrowDown", "Shift+Tab" or "ControlOrMeta+A" (Control on Windows and Linux, Command on macOS).
  • check() / uncheck() / setChecked(bool): tick a checkbox or pick a radio, and verify it changed: check() throws if the box didn't end up checked.
  • selectOption(value or label): choose from a <select> by value, label, or several at once for a multi-select.

The mental model: fill is pasting, pressSequentially is typing. Pasting is faster and almost always enough; type only when the page cares about the individual keystrokes.

tests/typing.spec.ts
import { test, expect, type Page } from "@playwright/test";

async function signIn(page: Page, path = "/practice/shop") {
  await page.goto(path);
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await expect(page).toHaveURL(path);
}

test("fill sends one input event; pressSequentially sends a key press per character", async ({ page }) => {
  await signIn(page);
  const search = page.getByLabel("Search products");
  const products = page.getByRole("list", { name: "Products" }).getByRole("listitem");
  await expect(products).toHaveCount(8);
  // Record what the search box receives (only to see the difference; tests don't normally do this).
  await page.evaluate(() => {
    const w = window as unknown as { events: string[] };
    w.events = [];
    for (const type of ["keydown", "input"]) document.querySelector("#search")!.addEventListener(type, () => w.events.push(type));
  });
  const events = () => page.evaluate(() => (window as unknown as { events: string[] }).events.splice(0));

  await search.fill("mouse");
  console.log("fill:", (await events()).join(" "));
  await expect(products).toHaveCount(2);

  await search.clear();
  await events();
  await search.pressSequentially("desk", { delay: 50 });
  console.log("pressSequentially:", (await events()).join(" "));
  await expect(products).toHaveText([/Standing Desk Mat/]);
});

test("press, check and selectOption", async ({ page }) => {
  await signIn(page);
  await page.getByLabel("Sort by").selectOption("Price: high to low"); // by label
  await expect(page.getByRole("listitem").first()).toContainText("Noise-Cancelling Headphones");
  await page.getByLabel("Category").selectOption({ value: "Mice" }); // by value
  await expect(page.getByRole("listitem")).toHaveCount(2);
  await page.getByRole("listitem").filter({ hasText: "Wireless Mouse" }).getByRole("button", { name: "Add to cart" }).click();

  await page.getByRole("link", { name: "Cart (1)" }).click();
  await page.getByRole("link", { name: "Checkout" }).click();
  await page.getByLabel("Promo code").fill("save10");
  await page.getByLabel("Promo code").press("Enter"); // the shop applies the code on Enter
  await expect(page.getByText("SAVE10 applied: 10% off.")).toBeVisible();

  await page.getByLabel("Express").check();
  await page.getByLabel("I agree to the terms").check();
  await expect(page.getByLabel("Standard")).not.toBeChecked();
  await expect(page.getByTestId("order-total")).toHaveText("$36.54");
});
npx playwright test
Running 2 tests using 1 worker

fill: input
pressSequentially: keydown input keydown input keydown input keydown input
  ✓  1 [chromium] › tests/typing.spec.ts:11:1 › fill sends one input event; pressSequentially sends a key press per character (3.2s)
  ✓  2 [chromium] › tests/typing.spec.ts:35:1 › press, check and selectOption (2.0s)

  2 passed (6.0s)
What’s happening
  1. The first test records which events reach the search box, using page.evaluate to add listeners. That's only to make the difference visible; real tests check what the user sees.
  2. fill("mouse") produces a single input event: the whole value appears at once. The shop's search reacts to input, waits 0.3 s, and shows 2 products, which toHaveCount(2) waits for.
  3. clear() empties the box (its events are thrown away), then pressSequentially("desk", { delay: 50 }) produces a keydown and an input for each of the 4 letters. Each input restarts the shop's 0.3 s timer, so the list only updates after the last key; the assertion waits for the one product left, the Standing Desk Mat.
  4. Either way, the test never waits for the 0.3 s itself. The assertion waits for the outcome. (Chapter 2 showed another side of this: text filled while the products are still loading is applied the moment they arrive.)
  5. The second test: selectOption("Price: high to low") matches the option's label, and the headphones ($199) come first. selectOption({ value: "Mice" }) picks by value, leaving 2 products. Like click, it waits for the option to exist, which matters here because categories are only added after the products load.
  6. On checkout, press("Enter") in the promo box triggers the shop's keydown handler, which checks the code (lower-case "save10" is upper-cased by the shop). check() picks the Express radio (which unchecks Standard) and ticks the terms. The total is $29.50 − $2.95 (10%) + $9.99 = $36.54.
AdvancedKeys worth knowing
  • Key names are the browser's KeyboardEvent.key values: Enter, Tab, Escape, Backspace, Delete, ArrowDown, Home, End, PageDown, F1…F12, plus single characters ("a" and "A" differ).
  • Combine with +: "Shift+ArrowLeft", "Control+Enter". ControlOrMeta picks Control or Command by platform, so "ControlOrMeta+A" selects all everywhere.
  • locator.press() focuses the element first. page.keyboard.press() sends the key to whatever is focused now, which is what you want for page-wide shortcuts.
  • fill("") clears a field, as does clear(). To append rather than replace, focus the field and use pressSequentially, or read the value and fill the whole new value.
Advancedcheck() on custom checkboxes

#Uploads, downloads and drag and drop

Added

These three move data between the test and the page in ways a plain click can't:

  • Uploads: a real user picks a file in the operating system's dialog, which a test can't drive. Instead, setInputFiles hands files directly to the <input type="file">: paths on disk, or { name, mimeType, buffer } made in memory. An empty array clears the selection.
  • Downloads: the browser saves a file, and the test needs to read it. You start waiting for the download event before the click that triggers it, then download.path() or download.saveAs() gives you the file. Downloaded files are deleted when the browser context closes, so read or save them inside the test.
  • Drag and drop: source.dragTo(target) hovers the source, presses the mouse, moves to the target and releases, with the actionability checks for hover on both. For finer control there are mouse.down(), mouse.move() and mouse.up().

The mental model: the test stands in for the operating system. It chooses the file the user would have picked, catches the file the browser would have saved, and moves the mouse the way a hand would.

This suite runs in all three browsers, because file and drag handling is where engines differ most:

playwright.config.ts
import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
  testDir: "./tests",
  use: { baseURL: "https://rohit-playwright.pages.dev" },
  projects: [
    { name: "chromium", use: { ...devices["Desktop Chrome"] } },
    { name: "firefox", use: { ...devices["Desktop Firefox"] } },
    { name: "webkit", use: { ...devices["Desktop Safari"] } },
  ],
});
fixtures/notes.txt
Not a picture.
tests/files.spec.ts
import { test, expect, type Page } from "@playwright/test";
import { readFile } from "node:fs/promises";

async function signIn(page: Page, path = "/practice/shop") {
  await page.goto(path);
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await expect(page).toHaveURL(path);
}

test("uploading a profile picture, and a file that isn't one", async ({ page }) => {
  await signIn(page, "/practice/account");
  const picture = page.getByLabel("Profile picture");
  const message = page.getByRole("region", { name: "Profile" }).getByRole("status").filter({ hasText: /\w/ });

  await picture.setInputFiles({ name: "me.png", mimeType: "image/png", buffer: Buffer.alloc(3 * 1024) });
  await expect(message).toHaveText("Uploaded me.png (3 KB).");

  await picture.setInputFiles("fixtures/notes.txt"); // a real file on disk
  await expect(message).toHaveText("Please choose an image file (PNG, JPG or GIF).");
  await expect(picture).toHaveValue(""); // the shop cleared the rejected file
});

test("downloading the orders as CSV", async ({ page }) => {
  await page.addInitScript(() => {
    localStorage.setItem("shop-history", JSON.stringify([
      { id: "ORD-1001", placedAt: Date.UTC(2026, 10, 2, 12), items: 2, total: 104.49 },
      { id: "ORD-1002", placedAt: Date.UTC(2026, 10, 20, 12), items: 1, total: 29.5 },
    ]));
  });
  await signIn(page, "/practice/account");

  const downloadPromise = page.waitForEvent("download"); // start waiting before the click, no await
  await page.getByRole("button", { name: "Download orders (CSV)" }).click();
  const download = await downloadPromise;

  expect(download.suggestedFilename()).toBe("orders.csv");
  const csv = await readFile(await download.path(), "utf8");
  expect(csv.trim().split("\n")).toEqual(["order,date,items,total", "ORD-1001,2026-11-02,2,104.49", "ORD-1002,2026-11-20,1,29.50"]);
});

test("reordering the wishlist by drag and drop", async ({ page }) => {
  await signIn(page, "/practice/account");
  const wishes = page.getByRole("list", { name: "Wishlist" }).getByRole("listitem");
  await expect(wishes).toHaveText([/Monitor Light Bar/, /USB Microphone/, /Standing Desk Mat/]);

  await wishes.filter({ hasText: "Standing Desk Mat" }).dragTo(wishes.filter({ hasText: "Monitor Light Bar" }));

  await expect(wishes).toHaveText([/Standing Desk Mat/, /Monitor Light Bar/, /USB Microphone/]);
  await page.reload();
  await expect(wishes).toHaveText([/Standing Desk Mat/, /Monitor Light Bar/, /USB Microphone/]);
});
npx playwright test
Running 9 tests using 3 workers

  ✓  3 [chromium] › tests/files.spec.ts:12:1 › uploading a profile picture, and a file that isn't one (1.2s)
  ✓  1 [webkit] › tests/files.spec.ts:12:1 › uploading a profile picture, and a file that isn't one (1.7s)
  ✓  4 [chromium] › tests/files.spec.ts:25:1 › downloading the orders as CSV (1.1s)
  ✓  5 [webkit] › tests/files.spec.ts:25:1 › downloading the orders as CSV (1.3s)
  ✓  6 [chromium] › tests/files.spec.ts:43:1 › reordering the wishlist by drag and drop (1.2s)
  ✓  2 [firefox] › tests/files.spec.ts:12:1 › uploading a profile picture, and a file that isn't one (2.9s)
  ✓  7 [webkit] › tests/files.spec.ts:43:1 › reordering the wishlist by drag and drop (1.3s)
  ✓  8 [firefox] › tests/files.spec.ts:25:1 › downloading the orders as CSV (1.3s)
  ✓  9 [firefox] › tests/files.spec.ts:43:1 › reordering the wishlist by drag and drop (1.3s)

  9 passed (7.1s)
What’s happening
  1. The config runs every test in Chromium, Firefox and WebKit: 3 tests × 3 browsers = 9 runs, spread over several workers. fixtures/notes.txt is a real file in the project for the upload test.
  2. Upload. setInputFiles({ name, mimeType, buffer }) gives the input a 3 KB "PNG" made in memory (its bytes are zeros: the shop only checks the type and size, so no real image is needed). The shop shows "Uploaded me.png (3 KB)." message is the Profile region's status line that has any text, which skips the empty status elements next to it.
  3. setInputFiles("fixtures/notes.txt") uploads a file from disk; a relative path is resolved from the current working directory, here the project folder. It isn't an image type, so the shop rejects it, shows the error, and resets the input, which toHaveValue("") confirms. Note that setInputFiles doesn't care that the input is a styled, possibly invisible control: it has no actionability checks.
  4. Download. The order history is seeded first so the account page has something to export. waitForEvent("download") is started before the click; awaiting it after the click gives a Download. suggestedFilename() is the name the page asked for (orders.csv), and download.path() waits for the file to finish and returns where Playwright saved it. Its lines are exactly the header and the two orders, with $29.5 written as 29.50.
  5. Drag and drop. dragTo drags the Standing Desk Mat onto the Monitor Light Bar. The shop's drop handler moves it into that position, and the array assertion waits for the new order. Reloading proves the order was saved (to localStorage), not just drawn.
  6. All 9 runs pass, so the same three tests work in all three engines. That's not something to assume: HTML5 drag and drop in particular is implemented differently per browser, which is why this suite runs all three.
AdvancedUploads and downloads in practice
  • Several files: setInputFiles(["a.png", "b.png"]) for an input with multiple. Clear with setInputFiles([]).
  • No <input> in sight? Some pages open the file chooser from a button and create the input on the fly. Catch it: const chooserPromise = page.waitForEvent("filechooser"), click the button, then (await chooserPromise).setFiles("a.png").
  • Keep the file with await download.saveAs("downloads/orders.csv"); otherwise it's deleted when the context closes. download.failure() returns the error if the download failed.
  • Assert on the content, not just the name. A download test that only checks suggestedFilename() passes when the file is empty.

dragTo works for HTML5 drag and drop (the shop's draggable list) and for most mouse-event-based libraries. If a library needs intermediate moves (it only starts dragging after the pointer moves a few pixels, or listens for dragover), do it by hand. The docs note that dragover needs at least two mouse moves to fire in all browsers:

await source.hover(); await page.mouse.down(); await target.hover(); await target.hover(); await page.mouse.up();

And always give users, and tests, a non-drag way too: the wishlist's "Move … up/down" buttons are faster to test and are what keyboard users need.

#Dialogs, hovers and focus

Added

Three interactions that confuse new Playwright users, each for a different reason:

  • Dialogs (alert(), confirm(), prompt(), beforeunload) are native browser pop-ups, not page elements, so locators can't see them. Playwright fires a dialog event instead. If nothing listens, Playwright dismisses every dialog automatically, which for confirm() means "Cancel". To accept, register a handler before the action that opens the dialog: page.once("dialog", (d) => d.accept()). A handler must accept or dismiss: the dialog blocks the page, and the docs warn that otherwise "your action will stall".
  • Hover shows things that only exist while the pointer is over an element: tooltips, menus, previews. hover() moves the mouse there (with the visible, stable and receives-events checks), and the effect lasts until the mouse moves elsewhere.
  • Focus is where keyboard input goes. focus() focuses an element without clicking; press("Tab") moves focus the way a keyboard user does; toBeFocused() checks where it is. Good components show the same help on focus as on hover, for keyboard users.

The mental model: a dialog is the browser asking the test a question. If the test hasn't said in advance how to answer, Playwright answers "no".

tests/dialogs.spec.ts
import { test, expect, type Page } from "@playwright/test";

async function signIn(page: Page, path = "/practice/shop") {
  await page.goto(path);
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await expect(page).toHaveURL(path);
}

test("with no handler, the confirm() is dismissed", async ({ page }) => {
  await signIn(page, "/practice/account");
  await page.getByRole("button", { name: "Delete account" }).click();
  await expect(page.getByText("Your account was not deleted.")).toBeVisible();
});

test("dismissing on purpose, and checking what the dialog said", async ({ page }) => {
  await signIn(page, "/practice/account");
  let asked = "";
  page.once("dialog", async (dialog) => {
    asked = `${dialog.type()}: ${dialog.message()}`;
    await dialog.dismiss();
  });
  await page.getByRole("button", { name: "Delete account" }).click();
  await expect(page.getByText("Your account was not deleted.")).toBeVisible();
  expect(asked).toBe("confirm: Delete your account? This can’t be undone.");
});

test("accepting deletes the account", async ({ page }) => {
  await signIn(page, "/practice/account");
  page.once("dialog", (dialog) => dialog.accept());
  await page.getByRole("button", { name: "Delete account" }).click();
  await expect(page.getByRole("status")).toHaveText("Your account was deleted.");
  await expect(page.getByRole("heading", { name: "Sign in" })).toBeVisible();
});

test("the name tooltip shows on hover and on focus", async ({ page }) => {
  await signIn(page, "/practice/account");
  const help = page.getByRole("button", { name: "Why we ask for a name" });
  const tooltip = page.getByRole("tooltip");

  await help.hover();
  await expect(tooltip).toHaveText("Shown on your orders and reviews.");
  await page.getByRole("heading", { name: "Your account" }).hover(); // move the mouse away
  await expect(tooltip).toBeHidden();

  await help.focus();
  await expect(help).toBeFocused();
  await expect(tooltip).toBeVisible();
  await page.keyboard.press("Escape");
  await expect(tooltip).toBeHidden();
  await expect(help).toHaveAccessibleDescription("Shown on your orders and reviews.");
});
npx playwright test
Running 4 tests using 1 worker

  ✓  1 [chromium] › tests/dialogs.spec.ts:11:1 › with no handler, the confirm() is dismissed (1.1s)
  ✓  2 [chromium] › tests/dialogs.spec.ts:17:1 › dismissing on purpose, and checking what the dialog said (1.1s)
  ✓  3 [chromium] › tests/dialogs.spec.ts:29:1 › accepting deletes the account (1.0s)
  ✓  4 [chromium] › tests/dialogs.spec.ts:37:1 › the name tooltip shows on hover and on focus (1.1s)

  4 passed (4.8s)
What’s happening
  1. No handler. The click opens confirm("Delete your account? …"). Nobody listens for dialog, so Playwright dismisses it, confirm() returns false, and the shop shows "Your account was not deleted." The click returns normally: nothing hangs, and nothing tells you a dialog happened. That silence is worth remembering when a test mysteriously "does nothing".
  2. Dismiss on purpose. page.once("dialog", …) is registered before the click. It records the dialog's type and message, then dismisses it. Asserting the message checks the user was asked the right question.
  3. Accept. The handler accepts, confirm() returns true, the shop deletes everything and goes to the sign-in page, which shows "Your account was deleted." in its status box. once (rather than on) means the handler is removed after one dialog, so it can't accidentally accept a later one.
  4. Hover. hover() moves the mouse over the "?" button; the tooltip appears. Hovering the page heading moves the mouse away, the shop's mouseleave hides it, and toBeHidden waits for that.
  5. Focus. focus() focuses the button without the mouse; the shop shows the tooltip on focus too, and toBeFocused confirms where focus is. Escape hides it. The last line checks the button's accessible description is the tooltip text, through its aria-describedby: that's what a screen reader announces after the name.
AdvancedA dialog handler that never answers

The docs' warning about stalling is real. In this test, the handler only logs the message and never accepts or dismisses. The run fails on purpose, with short timeouts so it ends quickly:

tests/stall.spec.ts
import { test, expect, type Page } from "@playwright/test";

async function signIn(page: Page, path = "/practice/shop") {
  await page.goto(path);
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await expect(page).toHaveURL(path);
}

test("a dialog handler that doesn't answer stalls the page", async ({ page }) => {
  test.setTimeout(8000);
  await signIn(page, "/practice/account");
  page.on("dialog", (dialog) => console.log("dialog:", dialog.message())); // ❌ never accepts or dismisses
  await page.getByRole("button", { name: "Delete account" }).click({ timeout: 2000 });
});
npx playwright test
Running 1 test using 1 worker

dialog: Delete your account? This can’t be undone.
  ✘  1 [chromium] › tests/stall.spec.ts:11:1 › a dialog handler that doesn't answer stalls the page (8.0s)


  1) [chromium] › tests/stall.spec.ts:11:1 › a dialog handler that doesn't answer stalls the page ──

    TimeoutError: locator.click: Timeout 2000ms exceeded.
    Call log:
      - waiting for getByRole('button', { name: 'Delete account' })
        - locator resolved to <button type="button" class="delete" data-delete-account="">Delete account</button>
      - attempting click action
        - waiting for element to be visible, enabled and stable
        - element is visible, enabled and stable
        - scrolling into view if needed
        - done scrolling
        - performing click action


      13 |   await signIn(page, "/practice/account");
      14 |   page.on("dialog", (dialog) => console.log("dialog:", dialog.message())); // ❌ never accepts or dismisses
    > 15 |   await page.getByRole("button", { name: "Delete account" }).click({ timeout: 2000 });
         |                                                              ^
      16 | });
      17 |
        at <project>/tests/stall.spec.ts:15:62

    Error Context: test-results/stall-a-dialog-handler-that-doesn-t-answer-stalls-the-page-chromium/error-context.md

  1 failed
    [chromium] › tests/stall.spec.ts:11:1 › a dialog handler that doesn't answer stalls the page ───
What’s happening
  1. Registering any dialog listener switches off the automatic dismissal: Playwright assumes you'll handle it.
  2. The click opens the confirm, the listener prints its message, and then nobody answers. The page's script is frozen inside confirm().
  3. The call log ends at "performing click action": the click was sent but never returned, and it fails when its 2-second timeout runs out. Look at the test's time, though: about 8 seconds, its whole timeout. The frozen page held up the clean-up after the failure too. Without the short timeouts, this would have hung for the default 30 seconds.
  4. The fix is one line in the handler: await dialog.accept() or await dialog.dismiss(). If you only want to log dialogs everywhere, log and dismiss.
AdvancedRegister the handler before the action

#When you really need to wait

Added

Actions and assertions already wait for elements, so explicit waits are rare. You need one when the next step depends on something that isn't an element the next line uses: a network response, a navigation finishing, a page loading in a new tab. The tools:

  • page.waitForResponse(urlOrPredicate): resolves when a matching response arrives. Start it before the action that sends the request.
  • page.waitForURL(url): resolves when the page has navigated to that URL (a string, glob or regex). Useful when the next step is itself a navigation, which doesn't wait for anything on the current page.
  • page.waitForLoadState(state): "load" (the default), "domcontentloaded" or "networkidle". Mostly needed for pages you didn't navigate to yourself, like popups. The docs mark "networkidle" DISCOURAGED for testing.
  • page.waitForTimeout(ms): a fixed sleep. The docs: "Never wait for timeout in production. Tests that wait for time are inherently flaky." Use it only while debugging.

The mental model: wait for the event, never for the clock. "Wait until the promo check comes back" is a fact about the app. "Wait 500 ms" is a guess about the machine.

The classic case is a navigation straight after a click. A click returns as soon as it's done, not when everything it started has finished. The shop's sign-in takes half a second to "talk to the server" before it saves the user, and page.goto doesn't wait for that:

tests/waiting.spec.ts
import { test, expect } from "@playwright/test";

test("❌ going to another page straight after clicking Sign in", async ({ page }) => {
  await page.goto("/practice/");
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await page.goto("/practice/account"); // the sign-in hasn't finished: nobody is signed in yet
  await expect(page).toHaveURL("/practice/account", { timeout: 2000 });
});

test("✅ waitForURL: let the sign-in finish first", async ({ page }) => {
  await page.goto("/practice/");
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await page.waitForURL("/practice/shop");
  await page.goto("/practice/account");
  await expect(page.getByRole("heading", { name: "Your account" })).toBeVisible();
});

test("✅ waitForResponse: the promo code check", async ({ page }) => {
  await page.goto("/practice/shop");
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await page.getByRole("listitem").filter({ hasText: "USB Microphone" }).getByRole("button", { name: "Add to cart" }).click();
  await page.getByRole("link", { name: "Cart (1)" }).click();
  await page.getByRole("link", { name: "Checkout" }).click();

  await page.getByLabel("Promo code").fill("WELCOME5");
  const responsePromise = page.waitForResponse("**/practice/api/promos/WELCOME5.json");
  await page.getByRole("button", { name: "Apply" }).click();
  const response = await responsePromise;

  expect(response.status()).toBe(200);
  expect(await response.json()).toEqual({ code: "WELCOME5", percent: 5 });
  await expect(page.getByTestId("order-total")).toHaveText("$71.24");
});

test("✅ waitForLoadState: a page you didn't navigate to", async ({ page }) => {
  await page.goto("/practice/account");
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  const popupPromise = page.waitForEvent("popup");
  await page.getByRole("link", { name: "Help centre" }).click();
  const help = await popupPromise;
  await help.waitForLoadState(); // "load": then reading the title once is safe
  expect(await help.title()).toBe("Help centre · Practice Shop");
});
npx playwright test
Running 4 tests using 1 worker

  ✘  1 [chromium] › tests/waiting.spec.ts:3:1 › ❌ going to another page straight after clicking Sign in (2.3s)
  ✓  2 [chromium] › tests/waiting.spec.ts:12:1 › ✅ waitForURL: let the sign-in finish first (770ms)
  ✓  3 [chromium] › tests/waiting.spec.ts:22:1 › ✅ waitForResponse: the promo code check (1.7s)
  ✓  4 [chromium] › tests/waiting.spec.ts:41:1 › ✅ waitForLoadState: a page you didn't navigate to (1.1s)


  1) [chromium] › tests/waiting.spec.ts:3:1 › ❌ going to another page straight after clicking Sign in 

    Error: expect(page).toHaveURL(expected) failed

    Expected: "https://rohit-playwright.pages.dev/practice/account"
    Received: "https://rohit-playwright.pages.dev/practice/?next=%2Fpractice%2Faccount"
    Timeout:  2000ms

    Call log:
      - Expect "toHaveURL" with timeout 2000ms
        21 × locator resolved to <html lang="en">…</html>
           - unexpected value "https://rohit-playwright.pages.dev/practice/?next=%2Fpractice%2Faccount"


       7 |   await page.getByRole("button", { name: "Sign in" }).click();
       8 |   await page.goto("/practice/account"); // the sign-in hasn't finished: nobody is signed in yet
    >  9 |   await expect(page).toHaveURL("/practice/account", { timeout: 2000 });
         |                      ^
      10 | });
      11 |
      12 | test("✅ waitForURL: let the sign-in finish first", async ({ page }) => {
        at <project>/tests/waiting.spec.ts:9:22

    Error Context: test-results/waiting-❌-going-to-another-ce50e-ight-after-clicking-Sign-in-chromium/error-context.md

  1 failed
    [chromium] › tests/waiting.spec.ts:3:1 › ❌ going to another page straight after clicking Sign in 
  3 passed (6.9s)
What’s happening
  1. The race (fails on purpose). Clicking "Sign in" starts the shop's half-second wait and returns. page.goto("/practice/account") runs at once, unloading the sign-in page before it saved the user. The account page finds nobody signed in and sends the browser back to sign-in. The assertion shows exactly that: the URL is the sign-in page with ?next=%2Fpractice%2Faccount.
  2. waitForURL. Waiting for /practice/shop (resolved against baseURL) means waiting for the result of the click: the shop only goes there after saving the user. Then the second navigation is safe. The signIn helpers in Chapters 4–6 do the same with await expect(page).toHaveURL(path), which also waits; use whichever reads better.
  3. waitForResponse. The response wait is started before clicking Apply, then awaited. The test can now check the response itself, its status and body, as well as the page: $74.99 − 5% ($3.75) = $71.24. That's useful when the response matters (an API contract) or when nothing on the page changes.
  4. waitForLoadState. A popup isn't something the test navigated to, so nothing has waited for it to load. waitForLoadState() waits for its load event; after that, a one-off read like title() is reliable. (await expect(help).toHaveTitle(…) would also work and needs no load wait, because it retries.)
  5. The pattern behind all three fixes: find the event that means "ready" and wait for that. Every one is faster than a sleep long enough to be safe, and none of them can be too short.
AdvancedwaitForTimeout: too short, or too slow

Here's the sleep version of "wait for the products". The shop needs about 1.2 seconds after you click Sign in (0.5 s to sign in, 0.7 s to load the products):

tests/sleeps.spec.ts
import { test, expect, type Page } from "@playwright/test";

async function clickSignIn(page: Page) {
  await page.goto("/practice/");
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
}

test("❌ sleep 400 ms: too short", async ({ page }) => {
  await clickSignIn(page);
  await page.waitForTimeout(400);
  expect(await page.getByRole("listitem").count()).toBe(8);
});

test("❌ sleep 3000 ms: passes, slowly", async ({ page }) => {
  await clickSignIn(page);
  await page.waitForTimeout(3000);
  expect(await page.getByRole("listitem").count()).toBe(8);
});

test("✅ wait for the outcome", async ({ page }) => {
  await clickSignIn(page);
  await expect(page.getByRole("listitem")).toHaveCount(8);
});
npx playwright test
Running 3 tests using 1 worker

  ✘  1 [chromium] › tests/sleeps.spec.ts:10:1 › ❌ sleep 400 ms: too short (661ms)
  ✓  2 [chromium] › tests/sleeps.spec.ts:16:1 › ❌ sleep 3000 ms: passes, slowly (3.2s)
  ✓  3 [chromium] › tests/sleeps.spec.ts:22:1 › ✅ wait for the outcome (1.4s)


  1) [chromium] › tests/sleeps.spec.ts:10:1 › ❌ sleep 400 ms: too short ────────────────────────────

    Error: expect(received).toBe(expected) // Object.is equality

    Expected: 8
    Received: 0

      11 |   await clickSignIn(page);
      12 |   await page.waitForTimeout(400);
    > 13 |   expect(await page.getByRole("listitem").count()).toBe(8);
         |                                                    ^
      14 | });
      15 |
      16 | test("❌ sleep 3000 ms: passes, slowly", async ({ page }) => {
        at <project>/tests/sleeps.spec.ts:13:52

    Error Context: test-results/sleeps-❌-sleep-400-ms-too-short-chromium/error-context.md

  1 failed
    [chromium] › tests/sleeps.spec.ts:10:1 › ❌ sleep 400 ms: too short ─────────────────────────────
  2 passed (6.5s)
What’s happening
  1. 400 ms is shorter than the 1.2 seconds the shop needs, so the count is 0 and the test fails. On a fast laptop a longer guess (say 1,500 ms) would pass, and then fail on a busy CI machine: that's how sleeps become flaky tests.
  2. 3,000 ms passes, but the test takes about 3 seconds longer than it needs to. Multiply by hundreds of tests and every run wastes minutes, and it will still fail on the day the server takes 3.1 seconds.
  3. The web-first assertion passes as soon as the 8 products are there, about 1.3 seconds after the click, and would wait up to 5 seconds on a slow day. It's both the fastest and the safest.
  4. If you're tempted to add a sleep, ask "what am I actually waiting for?" The answer is nearly always an element (assert it), a response (waitForResponse) or a URL (waitForURL).

#force: true and why it hides bugs

Added

Every action takes { force: true }, which the docs describe as disabling the non-essential actionability checks. In practice it means: don't wait for the element to be enabled, unobscured or stable, just send the mouse events to where the element is. It's tempting when a test fails with "element is not enabled" or "… intercepts pointer events": add force: true and the error goes away.

The error goes away; the problem doesn't. Those checks failed because a real user couldn't click either. Forcing the click doesn't make the button work; it makes the test stop noticing that it doesn't. The browser still decides what a mouse click at that point hits: a disabled button ignores it, and an overlay receives it.

The mental model: force: true is taping over the warning light. The dashboard is quiet; the engine is still broken.

tests/force.spec.ts
import { test, expect, type Page } from "@playwright/test";

async function signIn(page: Page, path = "/practice/shop") {
  await page.goto(path);
  await page.getByLabel("Username").fill("rohit");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await expect(page).toHaveURL(path);
}
const addButton = (page: Page, product: string) =>
  page.getByRole("listitem").filter({ hasText: product }).getByRole("button", { name: "Add to cart" });

test("force-clicking the sold-out button: the click 'works', nothing happens", async ({ page }) => {
  await signIn(page);
  await addButton(page, "Vertical Mouse").click({ force: true }); // no error
  await expect(page.getByRole("link", { name: "Cart (0)" })).toBeVisible();
  await expect(page.getByText("Added")).toHaveCount(0);
});

test("force-clicking through a cookie banner: the banner gets the click", async ({ page }) => {
  await signIn(page);
  await expect(addButton(page, "Wireless Mouse")).toBeEnabled();
  await page.evaluate(() => {
    document.body.insertAdjacentHTML("beforeend", '<div class="cookie-banner" style="position:fixed;inset:0;background:#0008">We use cookies</div>');
    document.querySelector(".cookie-banner")!.addEventListener("click", () => console.log("the banner was clicked"));
  });
  page.on("console", (message) => console.log("page says:", message.text()));

  await addButton(page, "Wireless Mouse").click({ force: true }); // no error

  await expect(page.getByRole("link", { name: "Cart (0)" })).toBeVisible();
});
npx playwright test
Running 2 tests using 1 worker

  ✓  1 [chromium] › tests/force.spec.ts:13:1 › force-clicking the sold-out button: the click 'works', nothing happens (1.8s)
page says: the banner was clicked
  ✓  2 [chromium] › tests/force.spec.ts:20:1 › force-clicking through a cookie banner: the banner gets the click (1.8s)

  2 passed (4.2s)
What’s happening
  1. The disabled button. click({ force: true }) skips the "enabled" check and sends a real mouse click to the sold-out button. The action completes without an error. But browsers don't fire click on a disabled <button>, so the shop never hears about it: the cart stays at 0 and no "Added" message appears.
  2. Imagine the bug version: a product that's in stock but whose button is wrongly disabled. Without force, the test fails with "element is not enabled", which is the bug report you want. With force, the click "succeeds", and only a strong assertion afterwards would catch it.
  3. The overlay. The banner covers the whole page. click({ force: true }) doesn't wait for the button to be unobscured; it clicks at the button's position, the browser hit-tests that point, and the banner receives the click. The page's own log, forwarded with page.on("console"), says so.
  4. Again the test's action passes while a real user is stuck behind the banner. Without force, the call log would have named the culprit: <div class="cookie-banner">We use cookies</div> intercepts pointer events (the first example in this chapter).
  5. Both tests pass only because they assert what really happened (Cart (0)). A test that forced the click and then checked something weak, like "no error was thrown", would be green against a broken shop.
AdvancedWhen force (or dispatchEvent) is acceptable

Almost never in a test of your own app. The rare honest uses:

  • A known, intended overlay you can't avoid, like a transparent element that some libraries put over a control and that forwards clicks. Even then, prefer clicking the element the user actually clicks.
  • Hover-revealed controls in a third-party widget you don't own and aren't testing.

Before reaching for it, try the honest fixes: wait for the overlay to go (await expect(banner).toBeHidden()), close it like a user would (click "Accept"), click the visible label of a styled checkbox, or fix the page. locator.dispatchEvent("click") is the same trap in another form: it fires a synthetic event with no checks at all (and on the shop's disabled button it did nothing either). If a test needs force, write a comment saying why, so a reviewer can judge it.

#Your turn: act like a user

Added
Your turn: an invalid promo code

On checkout, type BOGUS into "Promo code", press Enter, wait for the shop's request to come back, and check its status and the message the user sees. (Put any product in the cart first.)

Show answer
tests/promo.spec.ts
import { test, expect, type Page } from "@playwright/test";

async function signIn(page: Page, path = "/practice/shop") {
  await page.goto(path);
  await page.getByLabel("Username").fill("ana");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await expect(page).toHaveURL(path);
}

test("an unknown promo code is rejected", async ({ page }) => {
  await signIn(page);
  await page.getByRole("listitem").filter({ hasText: "Standing Desk Mat" }).getByRole("button", { name: "Add to cart" }).click();
  await page.getByRole("link", { name: "Cart (1)" }).click();
  await page.getByRole("link", { name: "Checkout" }).click();

  await page.getByLabel("Promo code").fill("bogus");
  const responsePromise = page.waitForResponse((r) => r.url().includes("/practice/api/promos/"));
  await page.getByLabel("Promo code").press("Enter");
  const response = await responsePromise;

  expect(response.status()).toBe(404);
  expect(response.url()).toContain("/promos/BOGUS.json");
  await expect(page.getByText("That code isn’t valid.")).toBeVisible();
  await expect(page.getByTestId("order-total")).toHaveText("$39.00");
});
npx playwright test
Running 1 test using 1 worker

  ✓  1 [chromium] › tests/promo.spec.ts:11:1 › an unknown promo code is rejected (1.9s)

  1 passed (2.4s)
What’s happening
  1. The arrange part puts the Standing Desk Mat ($39.00) in the cart and opens checkout.
  2. waitForResponse takes a predicate here, matching any promo request, and is started before press("Enter"), the key the shop listens for.
  3. The response is a 404, and its URL shows the shop upper-cased the code to BOGUS. Those are facts about the request, which only waitForResponse can check.
  4. Then what the user sees: the "isn't valid" message (with the shop's curly apostrophe), and a total with no discount, still $39.00.
Your turn: uploads that should and shouldn't work

Upload a GIF called cat.gif (8 KB, made in memory) and check the message and that the preview image now has a blob: source. Then upload a PDF and check it's rejected and the input is empty again.

Show answer
tests/uploads.spec.ts
import { test, expect, type Page } from "@playwright/test";

async function signIn(page: Page, path = "/practice/shop") {
  await page.goto(path);
  await page.getByLabel("Username").fill("ana");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await expect(page).toHaveURL(path);
}

test("a GIF is accepted, a PDF is not", async ({ page }) => {
  await signIn(page, "/practice/account");
  const picture = page.getByLabel("Profile picture");
  const message = page.getByText(/^(Uploaded|Please choose)/);

  await picture.setInputFiles({ name: "cat.gif", mimeType: "image/gif", buffer: Buffer.alloc(8 * 1024) });
  await expect(message).toHaveText("Uploaded cat.gif (8 KB).");
  await expect(page.getByAltText("Your profile picture")).toHaveAttribute("src", /^blob:/);

  await picture.setInputFiles({ name: "receipt.pdf", mimeType: "application/pdf", buffer: Buffer.from("%PDF-1.7") });
  await expect(message).toHaveText("Please choose an image file (PNG, JPG or GIF).");
  await expect(picture).toHaveValue("");
});
npx playwright test
Running 1 test using 1 worker

  ✓  1 [chromium] › tests/uploads.spec.ts:11:1 › a GIF is accepted, a PDF is not (1.0s)

  1 passed (1.5s)
What’s happening
  1. setInputFiles with a buffer creates the file in memory: the name and MIME type are what the page sees. 8 × 1024 bytes is reported as 8 KB.
  2. The message locator matches either outcome by its start, so one locator follows the status line through both uploads.
  3. After the GIF, the preview image's src is a blob: URL the shop made from the file, which proves the page actually used it, not just printed a message.
  4. The PDF's type is application/pdf, so the shop rejects it and resets the input; toHaveValue("") checks nothing is left selected.
Your turn: reorder with the buttons, then by dragging

On the account page, move "USB Microphone" to the top using its "Move … up" button, then drag "Standing Desk Mat" onto "USB Microphone". Check the order after each step and after a reload.

Show answer
tests/wishlist.spec.ts
import { test, expect, type Page } from "@playwright/test";

async function signIn(page: Page, path = "/practice/shop") {
  await page.goto(path);
  await page.getByLabel("Username").fill("ana");
  await page.getByLabel("Password").fill("playwright");
  await page.getByRole("button", { name: "Sign in" }).click();
  await expect(page).toHaveURL(path);
}

test("the wishlist can be reordered both ways and stays reordered", async ({ page }) => {
  await signIn(page, "/practice/account");
  const wishes = page.getByRole("list", { name: "Wishlist" }).getByRole("listitem");

  await page.getByRole("button", { name: "Move USB Microphone up" }).click();
  await expect(wishes).toHaveText([/USB Microphone/, /Monitor Light Bar/, /Standing Desk Mat/]);
  await expect(page.getByRole("button", { name: "Move USB Microphone up" })).toBeDisabled();

  await wishes.filter({ hasText: "Standing Desk Mat" }).dragTo(wishes.filter({ hasText: "USB Microphone" }));
  await expect(wishes).toHaveText([/Standing Desk Mat/, /USB Microphone/, /Monitor Light Bar/]);

  await page.reload();
  await expect(wishes).toHaveText([/Standing Desk Mat/, /USB Microphone/, /Monitor Light Bar/]);
});
npx playwright test
Running 1 test using 1 worker

  ✓  1 [chromium] › tests/wishlist.spec.ts:11:1 › the wishlist can be reordered both ways and stays reordered (1.2s)

  1 passed (1.7s)
What’s happening
  1. The "Move USB Microphone up" button swaps it with the item above, so it goes from second to first. Now that it's at the top, its "up" button is disabled, which is worth checking: it's a rule of the feature.
  2. Dragging the Standing Desk Mat onto the USB Microphone (now first) moves the mat into first place, pushing the others down.
  3. The reload proves both changes were saved, not just drawn.
  4. Testing the buttons as well as dragging matters: the buttons are how keyboard and screen-reader users reorder, and they're the more reliable path to test.

Written fresh, no doc. Tests were run with @playwright/test 1.65.1 (Chrome for Testing 159, Firefox 159, WebKit 27.2) against the Practice Shop at /practice/; facts come from playwright.dev, read 2026-11-24.

RohitDownloads · All chapters

Sync progress across devices

Type the same private phrase on your Mac and your phone, and your Learned ticks follow you between them — on every study site.

The phrase never leaves this device: only a fingerprint of it is sent, and the server stores a fingerprint of that. Anyone who knows the phrase could see or change your ticks, so pick something you don’t use elsewhere.

Sync is on in this browser.

Sync ID

This ID must be the same on every device. If another device shows a different one, its phrase is different (capital letters count): tap “Turn off here” on it and type the phrase again exactly.