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. Confirm bot filtering is the cause
- Load the page with ?__posthog_debug=true
- Look for 'likely bot' in the [PostHog.js] console lines
2. Override bot signals in tests
- Before page scripts run, override the user agent, navigator.webdriver and navigator.userAgentData in your test setup
- Re-run and check the Network tab for /e requests
3. Or include bots deliberately
- 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
- PostHog Events Not Showing Up
- PostHog Blocked by Ad Blockers
- PostHog Session Replay Not Recording
- PostHog Replay Broken: Missing CSS, Fonts or Blank Screen
- PostHog Bill Too High
- PostHog Feature Flags Not Working or Undefined
- PostHog Pageviews Missing or Duplicated in Next.js
- PostHog Numbers Different From Google Analytics
- PostHog Identify Merging Wrong Users
- PostHog Surveys Not Showing
- PostHog Toolbar or Heatmaps Not Loading
- Why Is PostHog So Slow?