Skip to content

Commit

Permalink
core(full-page-screenshot): emit screenshot commands in parallel (#15862
Browse files Browse the repository at this point in the history
)
  • Loading branch information
connorjclark authored Mar 11, 2024
1 parent 5854c54 commit f4beef6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/gather/gatherers/full-page-screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ class FullPageScreenshot extends BaseGatherer {
* @return {Promise<LH.Result.FullPageScreenshot['screenshot']>}
*/
async _takeScreenshot(context) {
const metrics = await context.driver.defaultSession.sendCommand('Page.getLayoutMetrics');
const result = await context.driver.defaultSession.sendCommand('Page.captureScreenshot', {
format: FULL_PAGE_SCREENSHOT_FORMAT,
quality: FULL_PAGE_SCREENSHOT_QUALITY,
});
const [metrics, result] = await Promise.all([
context.driver.defaultSession.sendCommand('Page.getLayoutMetrics'),
context.driver.defaultSession.sendCommand('Page.captureScreenshot', {
format: FULL_PAGE_SCREENSHOT_FORMAT,
quality: FULL_PAGE_SCREENSHOT_QUALITY,
}),
]);
const data = `data:image/${FULL_PAGE_SCREENSHOT_FORMAT};base64,` + result.data;

return {
Expand Down

0 comments on commit f4beef6

Please sign in to comment.