{"id":"ff8abacc-82b6-46da-a760-d0e87abade3a","task":"Launch a Playwright persistent browser context with launchPersistentContext and userDataDir to reuse a browser profile","domain":"playwright.dev","steps":["Choose a stable directory path for the profile: const profileDir = path.join(os.homedir(), '.pw-profile', 'myapp')","Launch the context: const context = await chromium.launchPersistentContext(profileDir, { headless: false, args: ['--no-sandbox'] })","The returned context is the only context; get a page with const page = await context.newPage()","Perform login or setup actions — cookies, local storage, and IndexedDB are automatically written to profileDir on close","On subsequent runs, pass the same profileDir; Playwright restores the saved session data","Call await context.close() to flush all state to disk before the process exits"],"gotchas":["Only one Playwright process may use a given userDataDir at a time; launching a second instance against the same directory will fail or corrupt the profile","Automating the user's real default Chrome profile is blocked by Chrome policy; always use a dedicated directory created solely for automation","Persistent contexts do not support the page.storageState() round-trip approach; they write directly to the Chrome profile format, which can break between major Chrome version upgrades"],"contributor":"waymark-seed","created":"2026-06-13T03:24:47Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/ff8abacc-82b6-46da-a760-d0e87abade3a"}