One inner_text() call turned a clean session into a HUMAN “press and hold” challenge on the next page. The cause was a marker event Playwright fires on every read and click. So we wrote our own SDK.

Playwright bot detection rarely rests on one flag. Anti-bots read navigator.webdriver, the HeadlessChrome user agent, Playwright’s exposed bindings, and the __playwright_mark_target__ event its actions dispatch. Stealth plugins patch page properties. They don’t stop events the driver fires, so the fix is to drop Playwright’s injected script.

Key Takeaways

  1. Playwright fired __playwright_mark_target__ on 4 of 4 calls we tested: inner_text, click, fill and text_content.
  2. The event fires with tracing off; one addEventListener call in a page script catches it.
  3. Patchright’s patch set, checked at its October 25, 2026 commit, still dispatches the event.
  4. Default headless Playwright reports navigator.webdriver = true; exposeFunction adds 2 window globals.
  5. fill() entered “hello world” with 0 keydown events and 1 input event.

Why we built yet another browser SDK

For a long time we recommended using Playwright with our cloud browsers. It’s popular, it’s well documented, and most people have used it before.

But anti-bots got smarter. Their researchers know Playwright inside out, and there are a ton of ways to detect it. A good fingerprint, an antidetect browser and good residential proxies won’t help. So we wrote our own SDK, for Python and TypeScript.

Roll Safe meme: can’t have Playwright leaks if you don’t use Playwright

When we got tired of patching Playwright

Once, one of our users came to us with a problem. They were collecting prices from one of the largest retailers in the US, protected by HUMAN (formerly PerimeterX). With Playwright, the first product page opened fine and the second showed a “press and hold” challenge.

The proxies and the fingerprint were not the cause. The same browser on the same proxies opened both pages when we used it without Playwright.

So we looked at the anti-bot script on the page. In it we found a listener for an event called __playwright_mark_target__. When the event fires, the script sends it to the anti-bot server. We break down the rest of that script in how PerimeterX detects bots.

Playwright fires this event when it reads text from an element or clicks it. In the user’s script that was inner_text(), the call that read the price. The event exists for Playwright’s trace viewer. It’s sent even when tracing is off, and any script on the page can listen for it.

To confirm, we took a clean browser with no Playwright and fired the event by hand from the console. The next page showed the challenge.

HUMAN press-and-hold challenge shown after firing Playwright’s marker event by hand from the DevTools console

We made a patch just for that user. It worked, but it’s far from ideal. Patchright, the popular stealth fork of Playwright, still has no patch for this event in its list of patches. And it’s only one leak out of many.

In the end we got tired of patching Playwright and wrote our own SDK. It works with the browser directly over CDP, without known automation leaks.

Which Playwright calls fire the marker event

This is the easiest Playwright bot detection signal to check yourself. We reproduced the leak on a local page. The page registers one listener before Playwright touches anything:

document.addEventListener("__playwright_mark_target__", (e) => {
  console.log("marked:", e.target.tagName);
}, true);

Then we called four common methods from Playwright for Python 1.56 on headless Chromium 141, with tracing off:

Playwright call Event fired Target
inner_text(".price") Yes <p>
click("#b") Yes <button>
fill("#i", "abc") Yes <input>
locator(".price").text_content() Yes <p>

The source explains why. In Playwright v1.64.0, nine element actions mark their target first: hover, click, dblclick, tap, selectOption, fill, setInputFiles, focus and type. Reads such as innerText go through the selector engine, which marks matched elements too. Patchright’s October 25, 2026 commit keeps the markTargetElements calls, so the event still reaches the page.

Test Your Browser Stack for $5

Run your Playwright code through a real browser and see which requests pass.

  • No card required
  • API key in 30 seconds
  • Change one line of code
Start with $5 credit

Other ways anti-bots detect Playwright

The marker event is one tell. Playwright bot detection usually combines several signals, and each one is cheap for a page script to read. We checked the defaults in the same setup:

Signal Default Playwright What exposes it
navigator.webdriver true Any headless launch
User agent Contains HeadlessChrome Any headless launch
window.__playwright__binding__ Absent Appears after exposeFunction or exposeBinding
window.__playwright__binding__controller__ Absent Appears with the binding above
__playwright_mark_target__ Fired Reads, clicks, fills
Text input 1 input, 0 keydown for fill() Form fields

Do Playwright stealth plugins hide these signals?

Partly. With playwright-stealth 2.0.3, navigator.webdriver flipped to false and the user agent lost HeadlessChrome. inner_text() still fired the marker event. The last three rows come from how Playwright drives the page, so a property patch can’t reach them. Patchright and rebrowser-patches work at the driver level, but neither removes the marker event.

One classic tell has faded. The console-serialization check for CDP’s Runtime.enable stopped working after two V8 patches in May 2025. Detection moved toward fingerprints, session history and input behavior. Our DataDome benchmark on Etsy shows the result: local Playwright Chromium failed 40 of 40 runs on US residential proxies.

How our SDK is different

Unlike Playwright, the SDK doesn’t install helper scripts in the page, fire marker events or change browser settings. That removes the driver-side Playwright bot detection signals in the table above. A stealth plugin patches only two of them.

Clicks and typing come from Surfsky’s human emulation. The cursor moves to a button with uneven speed and small corrections. Text is typed key by key, with pauses. Playwright jumps straight to the target, and its fill() drops the whole text into the field at once.

Cursor paths on the same sign-in form: Playwright on the left, Surfsky SDK on the right

There is also less to run. Playwright for Python puts a Node.js process between your script and the browser. The SDK talks to the browser directly. It also starts the browser for you with a proxy and a fingerprint. When your code is done, it stops the browser.

There are other libraries that work with the browser over CDP. With them you still need your own antidetect browser, proxies and human-like input. With the SDK you get all of it in 1 package.

The core of a script looks like this:

async with AsyncSurfsky() as client:
    async with client.browser(proxy=PremiumProxy(country="us")) as browser:
        await browser.goto("https://example.com/product/1")
        print(await browser.inner_text(".price"))
        await browser.click("a.next-product")

The same in TypeScript:

await using client = new Surfsky();
await using browser = await client.browser({
  proxy: { tier: "premium", country: "us" },
});
await browser.goto("https://example.com/product/1");
console.log(await browser.innerText(".price"));
await browser.click("a.next-product");

The SDK also makes full use of your plan. Give it a function and a list of tasks. It runs them in parallel on every browser your plan allows. You don’t count sessions or manage a pool yourself. If you’d rather use fewer browsers, you can set the number by hand.

We kept the API as simple as possible. The methods follow Playwright’s names (goto, click, fill and so on). You already know most of it.

If you already have Playwright or Puppeteer code, you will need to rewrite it. The method names follow Playwright’s, so it’s mostly simple work, and with an LLM it goes fast. You also don’t have to move everything at once. Playwright still works with Surfsky, so you can start with the scripts that get blocked.

The result

Here is what users who moved to the SDK tell us:

  • Their success rate is at least 30% higher.
  • They get far fewer captchas, and some get none at all.
  • Their sessions are no longer flagged as automation.
  • Their scripts run faster.
  • They write less code. Proxies, human emulation and browser control are built in.

Try it

Sign in at app.surfsky.io and copy your API token and base URL from the dashboard:

export SURFSKY_API_TOKEN='your-token'
export SURFSKY_API_BASE_URL='your-base-url'

Install the SDK:

uv add surfsky     # or: pip install surfsky
bun add surfsky    # or: npm install surfsky

Then start from an example in the repo:

If you work with a coding agent, give it our skill file. It tells the agent how to set up and use the SDK.

We hope the SDK saves you the time we lost chasing leaks and makes your work a little easier. Try it and tell us what you think, good or bad.