Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"listr": "^0.12.0",
"lodash": "^4.17.4",
"phantomjs-prebuilt": "^2.1.14",
"puppeteer": "^0.12.0",
"puppeteer": "^19.0.0",
"request": "^2.81.0",
"rsvp": "^4.0.1"
},
Expand Down
23 changes: 20 additions & 3 deletions src/renderers/chrome/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import Renderer from '../../renderer';

const { isString } = _;

const DEFAULT_BOOT_OPTIONS = {}; // use puppeteer defaults, https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
const DEFAULT_BOOT_OPTIONS = {
executablePath: '/usr/bin/chromium',
args: ['--no-sandbox', '--disable-setuid-sandbox']
};

export class ChromeRenderer extends Renderer {
static get DEFAULT_BOOT_OPTIONS() {
Expand Down Expand Up @@ -114,14 +117,28 @@ export class ChromeRenderer extends Renderer {
}

async renderPage(page, options = {}) {
let { path: filepath, type } = options;
let { path: filepath, type, waitForNavigation } = options;
let buffer;

if (!isString(type)) {
type = isString(filepath) ? path.extname(filepath).slice(1) : 'html';
type = type.length > 0 ? type : 'html';
}

if (waitForNavigation !== null && waitForNavigation !== undefined) {
if (waitForNavigation === false) {
return;
} else if (waitForNavigation === Object(waitForNavigation)) {
await page._chromePage.waitForNavigation(waitForNavigation);
} else {
await page._chromePage.waitForNavigation({
waitUntil: 'networkidle0',
timeout: 0
});
}
delete options.waitForNavigation;
}

switch (type) {
case 'html':
buffer = await page._chromePage.content();
Expand All @@ -130,7 +147,7 @@ export class ChromeRenderer extends Renderer {
let { emulateMedia } = options;

if (emulateMedia !== null && emulateMedia !== undefined) {
await page._chromePage.emulateMedia(emulateMedia);
await page._chromePage.emulateMediaType(emulateMedia);
delete options.emulateMedia;
}

Expand Down