Home > Web Front-end > JS Tutorial > body text

Dayof DaysOfCode

WBOY
Release: 2024-08-19 17:16:33
Original
1118 people have browsed it

Dayof DaysOfCode

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

The above is the detailed content of Dayof DaysOfCode. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template