DEV Community

KoichiArai
KoichiArai

Posted on

Day20 of 100DaysOfCode

I've been working on building another program since Day19. (I had to focus on other coding tasks.)
During this coding session, I encountered a few problems and was able to solve some of them.

Challenges I faced

  • How to use page.waitForXPath(xpath) The answer to this issue was found here:

"page.waitForXPath is not a function" in 22.10.0

The correct usage is to use waitForSelector(xpath/${xpathexpression}) instead.

  • SyntaxError: Unexpected token 'export'
    I ran into this error when I used the export statement in my function code. After trying various solutions, I couldn't figure out how to resolve it. So I decided to switch to using import instead of require in my main code.

  • TypeError: page.$x is not a function
    This was the toughest issue I faced today. Unfortunately, neither ChatGPT nor Google provided a clear solution. i tried various suggestions I found, such as removing and reinstalling Puppeteer, checking the Puppeteer version, and cleaning up dependencies in package.json, but none of these worked. I still haven't figured out the true cause of this problem.
    The instant solution to this issue is here:

refactor!: remove $x and waitForXpath #11782

Top comments (0)