Created
January 18, 2018 15:58
-
-
Save garywu/bcb9259da58c1e70044355b77c9e1078 to your computer and use it in GitHub Desktop.
puppeteer resize browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm using this code: | |
await page.setViewport({height, width}); | |
// Window frame - probably OS and WM dependent. | |
height += 85; | |
https://github.com/GoogleChrome/puppeteer/issues/1183 | |
// Any tab. | |
const {targetInfos: [{targetId}]} = await browser._connection.send( | |
'Target.getTargets' | |
); | |
// Tab window. | |
const {windowId} = await browser._connection.send( | |
'Browser.getWindowForTarget', | |
{targetId} | |
); | |
// Resize. | |
await browser._connection.send('Browser.setWindowBounds', { | |
bounds: {height, width}, | |
windowId | |
}); | |
I think that Tab window + Resize parts could be part browser API such as: | |
browser.resize({height, width}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment