How to resize Playwright browser window?
There is the method
page.setViewportSize()
(https://playwright.dev/docs/api/class-page#page-set-viewport-size)
to resize Playwright browser window.
With Crawlee/PlaywrightCrawler, How can I set the size of browser window ?
const crawler = new PlaywrightCrawler({
// Stop crawling after 5 pages
maxRequestsPerCrawl: 5,
// https://crawlee.dev/api/playwright-crawler/interface/PlaywrightLaunchContext
launchContext: {
// https://crawlee.dev/api/playwright-crawler/interface/PlaywrightLaunchContext#launchOptions
launchOptions: {
stealth: true,
headless: false,
},
?????
}, .....
Page | Playwright
* extends: [EventEmitter]
1 Reply
other-emerald•3y ago
You can pass any Playwright params to the
launchOptions
so this should work:
But you can also use page.setViewportSize()
in preNavigationHooks
https://crawlee.dev/api/puppeteer-crawler/interface/PuppeteerCrawlerOptions#preNavigationHooks