fascinating-indigo
fascinating-indigo•16mo 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
correct-apricot
correct-apricot•16mo 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,
},
},
},
},
});
fascinating-indigo
fascinating-indigoOP•16mo ago
@vojtechmaslan thank you 🙂 that is solution to my problem 🙂

Did you find this page helpful?