Skip to content

Commit 017756d

Browse files
committed
Accept any dialogs that appear
1 parent 93b9076 commit 017756d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

get-image.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ module.exports = async url => {
44
// disable sandbox in production
55
const browser = await puppeteer.launch({
66
slowMo: 100,
7+
// headless: false,
78
args: process.env.NODE_ENV === 'production' ? ['--no-sandbox'] : []
89
});
910

10-
const page = await browser.newPage();
11+
const context = await browser.createIncognitoBrowserContext();
12+
const page = await context.newPage();
13+
14+
// accept the "replace drawing" dialog if it shows up
15+
page.on('dialog', dialog => dialog.accept());
16+
1117
await page.goto(url);
1218
await page.click('[aria-label=Export]');
1319

0 commit comments

Comments
 (0)