gpt4 book ai didi

javascript - Puppeteer(评估失败 : syntaxerror: invalid or unexpcted token)

转载 作者:行者123 更新时间:2023-12-01 01:46:14 28 4
gpt4 key购买 nike

以下行错误:

await page.waitForFunction('document.querySelector(".eo-validation-code").inner‌​Text.length == 32');

这里是上下文:

    const puppeteer = require('puppeteer');
puppeteer.launch({ignoreHTTPSErrors: true, headless: false}).then(async browser => {
const page = await browser.newPage();
console.log(2);
await page.setViewport({ width: 500, height: 400 });
console.log(3)
const res = await page.goto('https://apps.realmail.dk/scratchcards/eovendo/gui/index.php?UserId=60sEBfXq6wNExN4%2bn9YSBw%3d%3d&ServiceId=f147263e75262ecc82d695e795a32f4d');
console.log(4)
await page.waitForFunction('document.querySelector(".eo-validation-code").inner‌​Text.length == 32').catch(err => console.log(err));

这基本上是这个答案的复制粘贴:https://stackoverflow.com/a/46825433/10238810异常(exception)的是,我更改了 querySelector 以查找类名为“eo-validation-code”的元素。

最佳答案

innerText 中的 r 符号出现问题(我认为可能是 BOM)
尝试一下:

    const puppeteer = require('puppeteer');
puppeteer.launch({ignoreHTTPSErrors: true, headless: false}).then(async browser => {
const page = await browser.newPage();
console.log(2);
await page.setViewport({ width: 500, height: 400 });
console.log(3)
const res = await page.goto('https://apps.realmail.dk/scratchcards/eovendo/gui/index.php?UserId=60sEBfXq6wNExN4%2bn9YSBw%3d%3d&ServiceId=f147263e75262ecc82d695e795a32f4d');
console.log(4)
await page.waitForFunction('document.querySelector(".eo-validation-code").innerText.length == 32').catch(err => console.log(err));

关于javascript - Puppeteer(评估失败 : syntaxerror: invalid or unexpcted token),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51937939/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com