I'm using puppeteer to scrape some data off of a website, but all of my selections for a certain element are always undefined.
const tempFunction = await page.evaluate(() => {
let a = document.querySelectorAll(".flex.flex-wrap.w-100.flex-grow-0.flex-shrink-0.ph2.pr0-xl.pl4-xl.mt0-xl.mt3")
let container = document.querySelector(".flex.flex-wrap.w-100.flex-grow-0.flex-shrink-0.ph2.pr0-xl.pl4-xl.mt0-xl.mt3")
let b = container.getElementsByClassName("mb1 ph1 pa0-xl bb b--near-white w-33")
return b
})
For some reason this code always returns undefined, but similar code works fine.
const checkData = await page.evaluate(() =>{
let tempArray = []
let element = document.querySelectorAll('.weather-block')
tempArray.push(element[0].innerText)
return tempArray
})
Even when trying to use specific selectors or id's, I only get undefined. Not sure where to go from here.