like-gold
like-gold•2y ago

Set custom screen resolution for playwright

I am trying to scrape mobile version of site. So I wanted to set custom resolution for web site, like you can do in developer tools for chrome. But in API I cannot find that option. Is there a way to set desired resolution for Playwright from crawlee? In lunch options I cannot see that option, even through ChatGPT suggest there is.
2 Replies
eastern-cyan
eastern-cyan•2y ago
Hello @crveni_mrav, you can use fingerprint options to set the viewport size. For example:
const crawler = new PlaywrightCrawler({
browserPoolOptions: {
fingerprintOptions: {
fingerprintGeneratorOptions: {
screen: {
minWidth: 1920,
maxWidth: 1920,
minHeight: 1080,
maxHeight: 1080,
},
},
},
},
});
const crawler = new PlaywrightCrawler({
browserPoolOptions: {
fingerprintOptions: {
fingerprintGeneratorOptions: {
screen: {
minWidth: 1920,
maxWidth: 1920,
minHeight: 1080,
maxHeight: 1080,
},
},
},
},
});
like-gold
like-goldOP•2y ago
@vojtechmaslan thank you 🙂 that is solution to my problem 🙂

Did you find this page helpful?