Skip to content

Commit

Permalink
fix: waitForTimeout is not a function (#674)
Browse files Browse the repository at this point in the history
* fix:issue #673

* fix: 更换延迟函数

* fix: goto改用waitUntil
  • Loading branch information
huvz04 authored May 1, 2024
1 parent c622f7e commit 7bbe1a9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,11 @@ export async function renderUrl (e, url, renderCfg = {}) {
const page = await _puppeteer.browser.newPage()
let base64
try {
await page.goto(url, { timeout: 120000 })
await page.goto(url, { timeout: 120000 , waitUntil: 'networkidle0' })
await page.setViewport(renderCfg.Viewport || {
width: 1280,
height: 720
})
await page.waitForTimeout(renderCfg.wait || 1000)
let buff = base64 = await page.screenshot({ fullPage: true })
base64 = segment.image(buff)
await page.close().catch((err) => logger.error(err))
Expand Down

0 comments on commit 7bbe1a9

Please sign in to comment.