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 theexport
statement in my function code. After trying various solutions, I couldn't figure out how to resolve it. So I decided to switch to usingimport
instead ofrequire
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 inpackage.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:
Top comments (0)