This content originally appeared on DEV Community and was authored by KoichiArai
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.waitForTimeoutdoesn't exist. In fact,.waitForTimeoutis deprecated and shouldn't be used.
This content originally appeared on DEV Community and was authored by KoichiArai
KoichiArai | Sciencx (2024-09-07T11:44:09+00:00) Day22 of 100DaysOfCode. Retrieved from https://www.scien.cx/2024/09/07/day22-of-100daysofcode/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.