Skip to content

Commit

Permalink
Replace deprecated page.waitForTimeout with NodeJS setTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru committed Jul 22, 2024
1 parent 1129a0a commit a1e63f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const puppeteer = require('puppeteer');
const fs = require('fs').promises; // Import the fs module
const fsSync = require('fs');
const yaml = require('js-yaml');
const { setTimeout } = require('node:timers/promises');

const GITHUB_WORKSPACE = process.env.GITHUB_WORKSPACE || '.';
const INPUT_OUTPUT = process.env.INPUT_OUTPUT || 'docs/example.png';
Expand Down Expand Up @@ -60,7 +61,7 @@ async function readYamlFile(filePath) {
await page.goto(INPUT_URL, {
waitUntil: 'networkidle2',
});
await page.waitForTimeout(INPUT_WAIT_FOR_TIMEOUT);
await setTimeout(INPUT_WAIT_FOR_TIMEOUT);

// Check if the custom.css file exists
if (fsSync.existsSync('custom.css')) {
Expand Down Expand Up @@ -88,7 +89,7 @@ async function readYamlFile(filePath) {
});
}, elementPaths);

await page.waitForTimeout(2000);
await setTimeout(2000);

}
if (INPUT_OUTPUT_TYPE == "jpeg") {
Expand Down

0 comments on commit a1e63f3

Please sign in to comment.