I have the following code, where I store all src in an array, I would like to store only img with class name xyz
const imgs = await page.$$eval('img[src]', imgs => imgs.map(img => img.getAttribute('src')));
I tried to user filter, but I couldn't reach the right syntax to do that.
Just add .xyz
to your query string:
const imgs = await page.$$eval('img.xyz[src]', imgs => imgs.map(img => img.getAttribute('src')));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With