playwright-go icon indicating copy to clipboard operation
playwright-go copied to clipboard

Does playwright-go has Stealth Mode support built-in?

Open NuLL3rr0r opened this issue 3 years ago • 2 comments
trafficstars

I've just head of Playwright-go and would like to evaluate it. One thing I need badly is Stealth Mode which could be used as Anti-Bot Detectoon similar to go-rod. I couldn't find anything in the examples/ folder for Playwright-go.

NuLL3rr0r avatar Jun 20 '22 17:06 NuLL3rr0r

You could use go-rod's js with playwright-go

e.g.

userAgent := "some valid user agent"
context, _ := browser.NewContext(playwright.BrowserNewContextOptions{
		UserAgent:    playwright.String(userAgent),
	})
page, _ := context.NewPage()

if err := page.AddInitScript(playwright.PageAddInitScriptOptions{
	Script: playwright.String(stealth.JS),
}); err != nil {
     // something didn't work
}

jdfergason avatar Jul 25 '22 15:07 jdfergason

Thank you very much for the snippet.

NuLL3rr0r avatar Jul 26 '22 12:07 NuLL3rr0r

Stealth mode is not in the scope of playwright-go.

mxschmitt avatar Sep 21 '22 11:09 mxschmitt

ty for the stealth scripts rec! This solved my exact issue. 🙌

markthethomas avatar Dec 03 '22 08:12 markthethomas

@jdfergason Thanks for posting this solution, can you please help me with stealth.JS file URL or some clue around that from where I could get that file? Thanks

tejaskumark avatar Apr 05 '24 13:04 tejaskumark

It's bundled with go-rod or you can get it directly from npm: https://www.npmjs.com/package/puppeteer-extra-plugin-stealth

jdfergason avatar Apr 05 '24 14:04 jdfergason