lib/js/screenshot-generator.js in Dhalang-0.7.0 vs lib/js/screenshot-generator.js in Dhalang-0.7.1

- old
+ new

@@ -3,13 +3,14 @@ const createScreenshot = async () => { const configuration = dhalang.getConfiguration(); let browser; + let page; try { browser = await dhalang.launchPuppeteer(configuration); - const page = await browser.newPage(); + page = await browser.newPage(); await dhalang.configure(page, configuration.userOptions); await dhalang.navigate(page, configuration); await page.screenshot({ ...{ @@ -21,11 +22,13 @@ }); } catch (error) { console.error(error.message); process.exit(1); } finally { - if (browser) { + if (browser && configuration.userOptions['browserWebsocketUrl'] === "") { browser.close(); + } else { + page.close(); } process.exit(); } }; createScreenshot(); \ No newline at end of file