MCPcopy Index your code
hub / github.com/ampproject/amphtml / resetPage

Function resetPage

build-system/tasks/visual-diff/browser.js:133–147  ·  view source on GitHub ↗

* Resets the size of a tab and loads about:blank. * * @param {!puppeteer.Page} page a Puppeteer control browser tab/page. * @param {?puppeteer.Viewport} viewport optional viewport size object with * numeric fields `width` and `height`. * @return {Promise }

(page, viewport = null)

Source from the content-addressed store, hash-verified

131 * @return {Promise<void>}
132 */
133async function resetPage(page, viewport = null) {
134 const width = viewport ? viewport.width : VIEWPORT_WIDTH;
135 const height = viewport ? viewport.height : VIEWPORT_HEIGHT;
136
137 log(
138 'verbose',
139 'Resetting tab to',
140 yellow('about:blank'),
141 'with size',
142 yellow(`${width}×${height}`)
143 );
144
145 await page.goto('about:blank');
146 await page.setViewport({width, height});
147}
148
149module.exports = {
150 locateChromeExecutablePath,

Callers 2

snapshotWebpagesFunction · 0.85
newPageFunction · 0.85

Calls 2

yellowFunction · 0.85
logFunction · 0.70

Tested by

no test coverage detected