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.
"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
The above is the detailed content of Dayof DaysOfCode. For more information, please follow other related articles on the PHP Chinese website!