i have never used this library before so i apologize if this may sound like a stupid question
so, what is going on is that i want to extract some specific text from this website
https://www.unieuro.it/online/
i already have browser.js, and all the requirements to make puppeteer work
so i just navigate to that website and make it search for something
keep in mind this is just a code sample
await page.goto("https://www.unieuro.it");
await page.waitForSelector('input[name=algolia-search]');
await page.type("input[name=algolia-search]","echo dot")
await page.click(".icon-search")
nothing wierd so far it works as intended, however after this step things get wierd really quickly.
first of all i was complitely unable to make it wait for any selector.
i tried to make it wait for the class collapsed hits__hit
, for the element article, or even the section, it would time out every single time, so i just gave up and used
await page.waitForTimeout(3000);
from here i'm trying to extract the elements that have the class: product-tile
specifically, i need the title, which is inside a a
element as textContent
that a
element is inside a div
with the class product-tile__title
so what i tried is a simple eval
var name = await page.$$eval(".product-tile__title" el => {
el.map(el => el.querySelector("a").textContent))
return el
})
this did not work at all, it gives me a bunch of empty objects inside an array
so i tried to install an extension called puppeteer recorder, and i tried to use the code it generated which is
const element1 = await page.$('.collapsed:nth-child(1) > .product-tile > .item-container > .info > .title')
in this case element1
does contain something, but it is in no way related to the title
and right now i'm stuck, im complitely unable to get the object i need in anyway and the results on the internet are not helping.
as a side note:
i wish there was a simpler way to make a scraper in node, why must all the libraries be so complicated and never work like you want them to