javascript - Puppeteer (Evaluation failed: syntaxerror: invalid or unexpcted token) - Stack Overflow

The error the following line:await page.waitForFunction('document.querySelector(".eo-validati

The error the following line:

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

Here it is in context:

    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('.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));

It's basically a copy paste of this answer: With the exception that I have changed the querySelector to find an element with the class name "eo-validation-code".

The error the following line:

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

Here it is in context:

    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));

It's basically a copy paste of this answer: https://stackoverflow./a/46825433/10238810 With the exception that I have changed the querySelector to find an element with the class name "eo-validation-code".

Share Improve this question asked Aug 20, 2018 at 20:16 Ryan CameronRyan Cameron 3712 gold badges5 silver badges16 bronze badges 1
  • By copying paste to Chrome console you will see .inner‌​..Textwhich means there are invisible characters between the inner and the Text. – Yami Odymel Commented Dec 8, 2020 at 18:34
Add a ment  | 

1 Answer 1

Reset to default 6

Something went wrong with your r symbol in innerText (i think it might be BOM)
Try it:

    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)); 

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745311585a4622023.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信