I'm still working on scraping tasks.
During these tasks, I've picked up a few techniques for specific situations, and I'm nothing them down for future reference.
What I learned
It's better to use the method
.click()
when the targeted element has an attribute likehref="Javascript:~"
. This ensures the click action is properly triggered.When you want to input text into a pre-filled textbox, clear it first by using:
await page.$eval("selector", element => element.value = "")
This will help avoid appending text to the existing value.
- The method
page.waitForTimeout
doesn't exist. In fact,.waitForTimeout
is deprecated and shouldn't be used.
Top comments (0)