I want to do a queryselectorall scrape with 35 different selectors that differ only in the number in the middle, after each scrape I want to mark where it started and ended.
When I try to replace part of the selector with the number that changes in the loop it returns null with
---- start ----
----- end ----- The selector works if there is no variable but a number between 0-35
When I replace selectors in a chrome console like this it works. Could it be that I'm making a mistake?, how to make it work in puppeteer?
//The usual stuff of puppateer....
var array = [];
for (let i = 0; i <= 35; i++) {
const theopeninfo2 = await page.evaluate(() => {
return Array.from(document.querySelectorAll("#accordion_wide_"+i+" > div > div.main > div:nth-child(1) > div.dynamic_cmp_wrapper.size_x2_3 > div.ad_additional_info_items_wide.dynamic_cmp.accordion_wide_theme > div.items_container > div:not(.delete)")).map( x=> x.innerText).join("\n")
})
let start = "----start----\n";
let end = "\n----end----";
let result_start = start.concat(theopeninfo2);
let result_start_end = result_start.concat(end);
array.push(result_start_end)
}
array = array.join("\n")
console.log (array)