Prompt
How do I fix browser automation when a site detects headless mode?
Latest observation
Oct 26, 2026
OpenAI APIWeb search: off
If a site detects headless mode, the safest fix is to avoid trying to evade detection and instead make your automation more like a legitimate browser session or use an approved integration/API.
Good, compliant approaches
-
Use a real browser profile
- Launch Chrome/Edge/Firefox in non-headless mode for testing.
- Reuse a persistent user profile so cookies, storage, fonts, and settings are normal.
-
Use the site’s official API or integration
- Many sites provide APIs, widgets, or partner integrations specifically for automation.
- This is the most reliable option and avoids terms-of-service issues.
-
Get allowlisting or permission
- If you’re doing QA, monitoring, or internal testing, ask the site owner to allow your traffic or provide a test environment.
-
Make automation behavior realistic and stable
- Ensure normal navigation timing, waits for page load, and proper user interactions.
- Avoid extremely rapid, repetitive, or malformed requests.
-
Use a standard browser setup
- Keep your browser updated.
- Use the same browser build and OS as real users where possible.
- Disable extensions that interfere with pages, but keep the environment otherwise ordinary.
-
Handle bot checks gracefully
- If the site presents a CAPTCHA, challenge, or anti-bot page, stop and switch to a manual/approved flow rather than bypassing it.
For testing your own app
If you’re detecting headless mode in your own application and want to reduce false positives:
- Test with both headless and headed runs.
- Log which signals trigger the detection.
- Prefer risk scoring over hard blocking.
- Provide a QA bypass or test flag in non-production environments.
If you tell me what automation tool you’re using (Playwright, Selenium, Puppeteer, etc.) and whether this is your own site or a third-party site, I can suggest a compliant setup that improves reliability without trying to bypass protections.