PostHog Not Capturing Events in Playwright or Puppeteer Tests

Workaround available Web Updated October 21, 2026

Quick answer

PostHog's JS SDK treats automated browsers as bots, so Playwright, Puppeteer and Selenium runs send no events even though flags and identify still work. Confirm with ?__posthog_debug=true and override the bot signals if you need test events.

Most likely fix: Confirm bot filtering is the cause.

Symptoms

Events appear when you browse manually but not during E2E or headless test runs.

Why it happens

  • navigator.webdriver is true in automated browsers
  • User agent contains HeadlessChrome
  • Bot filtering is on by default in posthog-js

How to fix it

Try these in order — the most common fix is first.

  1. 1. Confirm bot filtering is the cause

    1. Load the page with ?__posthog_debug=true
    2. Look for 'likely bot' in the [PostHog.js] console lines
  2. 2. Override bot signals in tests

    1. Before page scripts run, override the user agent, navigator.webdriver and navigator.userAgentData in your test setup
    2. Re-run and check the Network tab for /e requests
  3. 3. Or include bots deliberately

    1. Set opt_out_useragent_filter: true in a test-only config; bot events are tagged with $browser_type

This guide also covers

  • posthog playwright no events
  • posthog puppeteer not tracking
  • posthog headless chrome
  • posthog bot filtering

Still not working?

If PostHog keeps failing, you're not alone. See every PostHog problem users report or the alternatives people switch to.

Other PostHog errors