lib/js/screenshot-generator.js in Dhalang-0.5.0 vs lib/js/screenshot-generator.js in Dhalang-0.6.0
- old
+ new
@@ -1,18 +1,18 @@
'use strict';
const dhalang = require('./dhalang')
-const createPdf = async () => {
+const createScreenshot = async () => {
const configuration = dhalang.getConfiguration();
let browser;
try {
browser = await dhalang.launchPuppeteer(configuration);
const page = await browser.newPage();
- await dhalang.configurePage(page, configuration.userOptions);
- await page.goto(configuration.webPageUrl, dhalang.getNavigationParameters(configuration));
- await page.waitForTimeout(250);
+ await dhalang.configure(page, configuration.userOptions);
+ await dhalang.navigate(page, configuration);
+
const screenshotOptions = configuration.imageType === "png" ? configuration.pngOptions : configuration.jpegOptions
await page.screenshot({
...{
path: configuration.tempFilePath,
type: configuration.imageType,
@@ -27,6 +27,6 @@
browser.close();
}
process.exit();
}
};
-createPdf();
+createScreenshot();
\ No newline at end of file