Day22 of 100DaysOfCode

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 elemen…


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 like href="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.


This content originally appeared on DEV Community and was authored by KoichiArai


Print Share Comment Cite Upload Translate Updates
APA

KoichiArai | Sciencx (2024-09-07T11:44:09+00:00) Day22 of 100DaysOfCode. Retrieved from https://www.scien.cx/2024/09/07/day22-of-100daysofcode/

MLA
" » Day22 of 100DaysOfCode." KoichiArai | Sciencx - Saturday September 7, 2024, https://www.scien.cx/2024/09/07/day22-of-100daysofcode/
HARVARD
KoichiArai | Sciencx Saturday September 7, 2024 » Day22 of 100DaysOfCode., viewed ,<https://www.scien.cx/2024/09/07/day22-of-100daysofcode/>
VANCOUVER
KoichiArai | Sciencx - » Day22 of 100DaysOfCode. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/07/day22-of-100daysofcode/
CHICAGO
" » Day22 of 100DaysOfCode." KoichiArai | Sciencx - Accessed . https://www.scien.cx/2024/09/07/day22-of-100daysofcode/
IEEE
" » Day22 of 100DaysOfCode." KoichiArai | Sciencx [Online]. Available: https://www.scien.cx/2024/09/07/day22-of-100daysofcode/. [Accessed: ]
rf:citation
» Day22 of 100DaysOfCode | KoichiArai | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.