Playwright stealth

Viewed 5575

I have been using puppeteer for a while, but decided to convert to playwright. In puppeteer, there was a plugin puppeteer-extra-stealth which was able to hide headless chrome and websites did not detect headless mode. Is there a similar thing for playwright?

3 Answers

There is a playwright-extra in development however according to the creator this won't include the stealth evasions. See: https://github.com/berstend/puppeteer-extra/pull/303 for more information.

That being said, you don't really need an external package in order to implement functionality that the puppeteer-extra-stealth package offers. Here is my attempt: https://gist.github.com/nicoandmee/1ec1b6a07c94f82df41d2496194ef3a6

In addition to doing everything the puppeteer package is doing, my code is generating a unique browser fingerprint based on real data collected from google analytics. This fingerprint is then used as part of the "evasions." It should be sufficient for most use-cases.

There is playwright-stealth, but it uses python. With that said, the API for playwright is very similar across languages, shouldn't be very hard to port it to the one you want to use it in.

Related