Fix Puppeter deprecation warnings

This commit is contained in:
ngosang 2022-01-30 23:23:06 +01:00
parent 0cbca1fb79
commit 0a438358d1
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ export default async function resolveChallenge(url: string, page: Page, response
// wait until redirecting disappears // wait until redirecting disappears
while (true) { while (true) {
try { try {
await page.waitFor(1000) await page.waitForTimeout(1000)
const displayStyle2 = await page.evaluate(() => { const displayStyle2 = await page.evaluate(() => {
return getComputedStyle(document.querySelector('#cf-spinner-redirecting')).getPropertyValue("display"); return getComputedStyle(document.querySelector('#cf-spinner-redirecting')).getPropertyValue("display");
}); });
@ -96,7 +96,7 @@ export default async function resolveChallenge(url: string, page: Page, response
} }
log.debug('Waiting for Cloudflare challenge...') log.debug('Waiting for Cloudflare challenge...')
await page.waitFor(1000) await page.waitForTimeout(1000)
} }
log.debug('Validating HTML code...') log.debug('Validating HTML code...')

View File

@ -177,7 +177,7 @@ async function gotoPage(params: V1Request, page: Page): Promise<HTTPResponse> {
</html> </html>
` `
); );
await page.waitFor(2000) await page.waitForTimeout(2000)
try { try {
await page.waitForNavigation({waitUntil: 'domcontentloaded', timeout: 2000}) await page.waitForNavigation({waitUntil: 'domcontentloaded', timeout: 2000})
} catch (e) {} } catch (e) {}