

Typically, in my experience, the reason the elements are being appended with Javascript is that the data is being pulled externally from an API, this is a simple fix because you can just check the networking tools to see an XHR request which gets the data, usually it's in an easier-to-parse format too because it's being pulled from an API (JSON). I saw your response regarding waiting for the elements to load, this is possible using something like JSDOM/Puppeteer but it's completely overkill and would most likely result in bugs from unsupported JS and/or a massive CPU/Memory overhead in comparison to something like Cheerio. There are a few ways we can handle this to get the same data. He was correct in saying the elements are being appended with Javascript. I saw the answer from and although it explained what was happening, it doesn't provide a solution. Here is a short version of the code: const axios = require('axios') Ĭonsole.log($('.ranking-item-wrapper')) // => tutorial classĬonsole.log($('.lista-jogos_jogo')) // => class that I'm using I don't get why I'm getting this error, since I'm doing exectly the same thing as it is done in the tutorial. With the group of classes of the tutorial it brings all the elements with the selected class, but with other classes it doesn't work:Īs can be seen all fifty elements with the class ranking-item-wrapper are returned, but if I select elements with the class lista-jogos_jogo it doesn't return anything: It works fine, however I'm trying to get different elements from the same webpage: I just started learning about web scraping and I found this tutorial:
