1
I’m making a Scrapping on a website that organizes items with a tag <a>
, however I am getting several values with null
.
How can I place a parole to avoid these values null
on the return?
const result = await page.evaluate(() => {
const medicines = []
document.querySelectorAll('div > div > div > div > div > a')
.forEach(
medicine => if(medicine.getAttribute('title')!== null){
medicines.push(medicine.getAttribute('title'))
}
)
return medicines
})
It has many forms, but why not use one
for
Is it really that much easier to do this? It’s not your fault, it’s that there are people teaching wrong around, but this code has not gained any doing so, on the contrary, there is only problem.– Maniero