adverse-sapphire•3y ago
Custom user agent playwright browser
how can put a custom user agent into the playwright crawler context?

8 Replies
adverse-sapphireOP•3y ago
Like the image above
xenial-black•3y ago
Hey there, please check the browser pool docs: https://github.com/apify/browser-pool#manipulating-playwright-context-using-pageoptions-or-launchoptions + https://crawlee.dev/api/playwright-crawler/interface/PlaywrightLaunchContext#launchOptions
adverse-sapphireOP•3y ago
I Already tried, but it doesn't set the user agent in the browser, just the header.
xenial-black•3y ago
what do you mean by that? If you see it the headers - it means it's set. If you see this user-agent in browser request headers - it means it's set
adverse-sapphireOP•3y ago
My crawlee is printing this agent

adverse-sapphireOP•3y ago
i want this 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 Edg/104.0.1293.63'
adverse-sapphireOP•3y ago
I tried to put but not work

xenial-black•3y ago
Got it. This should work:
and maybe also switch off fingerprints (but not necessary):
browserPoolOptions: { useFingerprints: false },
as another crawler option