update screenshot

This commit is contained in:
joseph le 2023-09-15 13:33:47 +07:00
parent 13b4f6f7f6
commit 2c3114fdc1
1 changed files with 5 additions and 4 deletions

View File

@ -2,14 +2,17 @@ const puppeteer = require("puppeteer");
(async () => { (async () => {
// Launch a headless browser // Launch a headless browser
const browser = await puppeteer.launch(); const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox"],
});
// Open a new page // Open a new page
const page = await browser.newPage(); const page = await browser.newPage();
await page.goto( await page.goto(
"https://logs.danielvu.com/screenShot/20230913-TEST01-Session.Port4-6-172.16.20.7.log" "https://logs.danielvu.com/screenShot/20230913-TEST01-Session.Port4-6-172.16.20.7.log"
); );
const bodyHandle = await page.$('body'); const bodyHandle = await page.$("body");
const { height } = await bodyHandle.boundingBox(); const { height } = await bodyHandle.boundingBox();
await bodyHandle.dispose(); await bodyHandle.dispose();
await page.setViewport({ width: 1920, height: 500 }); await page.setViewport({ width: 1920, height: 500 });
@ -98,8 +101,6 @@ const puppeteer = require("puppeteer");
// send(); // send();
// Usage example // Usage example
// const filePath = __dirname+'\\screenshot.png'; // const filePath = __dirname+'\\screenshot.png';
// uploadFileToZulip(filePath); // uploadFileToZulip(filePath);