How to set viewport / browser size
I searched all the documentation but I couldn't find anywhere how to set viewport. I'm especially interested in this in the context of
PlaywrightCrawler
. I don't need a specific answer, just outline how to find it.5 Replies
hard-chocolate•3y ago
you can use
preNavigationHooks
option to set it:
playwright docs: https://playwright.dev/docs/api/class-page#page-set-viewport-sizeratty-blush•3y ago
Should also be possible with somewhat like that (not :
which is internally using https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context-option-viewport
BrowserType | Playwright
BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a typical example of using Playwright to drive automation:
harsh-harlequin•3y ago
Per discussion with @petrpatek. , it is better to set this in https://crawlee.dev/api/browser-pool/interface/FingerprintOptions (missing correct type) so it is in line with fingerprint
correct-apricot•2y ago
This doesn't seem to work - trying to specify
viewport
in launchOptions
generates a type error. Has it been deprecated or is there some other way to set it?
Full code that generates the error:
hard-chocolate•2y ago
Did you try to set it in preNavigationHooks or in https://crawlee.dev/api/browser-pool/interface/FingerprintOptions ? (Examples above)