Merge pull request #28266 from tobold/master

[puppeteer] add option defaultViewport to launchOptions interface to adhere to official docs
This commit is contained in:
Armando Aguirre
2018-09-04 10:56:50 -07:00
committed by GitHub
2 changed files with 30 additions and 0 deletions
+29
View File
@@ -1647,6 +1647,35 @@ export interface LaunchOptions {
* Useful so that you can see what is going on.
*/
slowMo?: number;
/**
* Sets a consistent viewport for each page. Defaults to an 800x600 viewport. null disables the default viewport.
*/
defaultViewport?: {
/**
* page width in pixels.
*/
width?: number;
/**
* page height in pixels.
*/
height?: number;
/**
* Specify device scale factor (can be thought of as dpr). Defaults to 1.
*/
deviceScaleFactor?: number;
/**
* Whether the meta viewport tag is taken into account. Defaults to false.
*/
isMobile?: boolean;
/**
* Specifies if viewport supports touch events. Defaults to false.
*/
hasTouch?: boolean;
/**
* Specifies if viewport is in landscape mode. Defaults to false.
*/
isLandscape?: boolean;
};
/**
* Additional arguments to pass to the Chromium instance. List of Chromium
* flags can be found here.
+1
View File
@@ -167,6 +167,7 @@ puppeteer.launch().then(async browser => {
'--no-sandbox',
'--disable-setuid-sandbox',
],
defaultViewport: { width: 800, height: 600 },
handleSIGINT: true,
handleSIGHUP: true,
handleSIGTERM: true,