Sha256: ee0c3691d3ae1a249716fbfd65cb953cc2f475cb17d10855881b3f7153e9c62d

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 Bytes

Contents

'use strict';
const dhalang = require('./dhalang');
const fs = require('node:fs');

const scrapeHtml = async () => {
    const configuration = dhalang.getConfiguration();

    let browser;
    let page;
    try {
        browser = await dhalang.launchPuppeteer(configuration);
        page = await browser.newPage();
        await dhalang.configure(page, configuration.userOptions);
        await dhalang.navigate(page, configuration);
        const html = await page.content();
        fs.writeFileSync(configuration.tempFilePath, html);
    } catch (error) {
        console.error(error.message);
        process.exit(1);
    } finally {
        if (browser && configuration.userOptions['browserWebsocketUrl'] === "") {
            browser.close();
        } else {
            page.close();
        }
        process.exit(0);
    }
};
scrapeHtml();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
Dhalang-0.7.2 lib/js/html-scraper.js
Dhalang-0.7.1 lib/js/html-scraper.js