2

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.com/a/46825433/10238810 With the exception that I have changed the querySelector to find an element with the class name "eo-validation-code".

Ryan Cameron
  • 371
  • 1
  • 4
  • 14
  • By copying paste to Chrome console you will see `.inner‌​..Text`which means there are invisible characters between the `inner` and the `Text`. – Yami Odymel Dec 08 '20 at 18:34

1 Answers1

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)); 
ymd
  • 682
  • 5
  • 18
  • Wait what? Is my r ... not a r? Hmm, strange it works now, not sure why though?! I am curious how did you figure that out? – Ryan Cameron Aug 20 '18 at 20:23
  • I tried to paste part of your code to console and "r" was "\u200b" or smth like that... – ymd Aug 20 '18 at 20:25
  • BTW, if it solved your problem, you can check the box next to the answer to accept it. – Aankhen Aug 21 '18 at 12:17