-
-
Notifications
You must be signed in to change notification settings - Fork 748
Closed
Description
What are you trying to achieve?
I want to resize the browser window
What do you get instead?
I get a bigger viewport size, but the browser window size stays the same.
See also puppeteer/puppeteer#1183
Details
- CodeceptJS version: 1.1.5
- NodeJS Version: 8.9.4
- Operating System: Windows
- Puppeteer (1.0.0)
I would recommend considering the following code for the resizeWindow function which seems to work well
async resizeWindow(width, height) {
await this.page.setViewport({height, width});
// Window frame - probably OS and WM dependent.
height += 85;
// Any tab.
const {targetInfos: [{targetId}]} = await this.browser._connection.send(
'Target.getTargets'
);
// Tab window.
const {windowId} = await this.browser._connection.send(
'Browser.getWindowForTarget',
{targetId}
);
// Resize.
await this.browser._connection.send('Browser.setWindowBounds', {
bounds: {height, width},
windowId
});
}
Mehuge, ek, Aankhen, pablogravielseo, justnpT and 16 more
Metadata
Metadata
Assignees
Labels
No labels