2

I want scrape data from one website from listing. My code:

    const listing = await page.evaluate(() => {
       Array.from(
        document.querySelectorAll(
          "#__next > div> main > div> div > div > div > div > ul > li "
        ),
        (element) => {
          const url = element; // > a
          const title = element; // > a > article > div > h3
          const address = element; // > a > article > p
          const price = element; // > a > article > div > span:nth-child(1)
          const priceForMeter = element; // > a > article > div > span:nth-child(2)
          const area = element; // > a > article > div > span:nth-child(3)
          const userProfile = element; // > a > article > div > div
        }
      );
    });

I want when I scraping each position on listing by this code:

"#__next > div> main > div> div > div > div > div > ul > li "

Scraping from each position additionaly bellow element:

        (element) => {
          const url = element; // > a
          const title = element; // > a > article > div > h3
          const address = element; // > a > article > p
          const price = element; // > a > article > div > span:nth-child(1)
          const priceForMeter = element; // > a > article > div > span:nth-child(2)
          const area = element; // > a > article > div > span:nth-child(3)
          const userProfile = element; // > a > article > div > div
        }
      );

How I can add to each position scraping nasted element (please look in comments by each variable). Any ideas?

robokonk
  • 101
  • 1
  • 5
  • Have you tried calling `element.querySelector("your nested selector")` to fill in the url, title, address, etc? It's generally a good idea to show the site you're working with, otherwise I can't really write an answer beyond this suggestion. – ggorlen Apr 27 '22 at 19:26

0 Answers0