-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helper script that runs chromium.
The feature that we were previously using in chromium_headless v110 and earlier seems to have been removed in v111. This changes the code to use puppeteer-core to interact with chromium. This change is intended to be a drop in replacement: The portal_settings config that specifies the path to chromium is still used and we package the puppeteer code so no need for post install steps.
- Loading branch information
Showing
9 changed files
with
1,280 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"env": { | ||
"node": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2018 | ||
}, | ||
"rules": { | ||
"no-console": "off" | ||
}, | ||
"globals": { | ||
"document": "readonly" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env node | ||
const puppeteer = require('puppeteer-core'); | ||
const args = require('yargs').argv; | ||
|
||
(async () => { | ||
const browser = await puppeteer.launch({ | ||
executablePath: args['path-to-chrome'], | ||
args: ['--no-sandbox', '--disable-extensions', '--disable-setuid-sandbox'] | ||
}); | ||
const page = await browser.newPage(); | ||
|
||
if (args['window-size']) { | ||
let dimensions = args['window-size'].split(','); | ||
await page.setViewport({ | ||
width: parseInt(dimensions[0], 10), | ||
height: parseInt(dimensions[1], 10), | ||
deviceScaleFactor: 1 | ||
}); | ||
} | ||
|
||
await page.goto('file://' + args['input-file']); | ||
|
||
const innerHtml = await page.evaluate(() => document.querySelector('.highcharts-container').innerHTML); | ||
|
||
console.log(JSON.stringify(innerHtml)); | ||
|
||
await browser.close(); | ||
})(); |
Oops, something went wrong.