I'm trying to grab this color from this webpage with puppeteer. But I'm having issues to scrape that color correctly.
const productColor_Selector = '.lang1 p:nth-of-type(1)'
const productColor = await page.$eval(productColor_Selector, e => e.textContent)
console.log("color", productColor)
let colorFilter = productColor;
let splitColor = colorFilter.split('Color:');
let colorProduct = splitColor[1].trim().split(' ')[1];
console.log("Final Color:", colorProduct)
As a result of running my code sometimes I get color but it is in a bad format and sometimes it returns as undefined: see the screenshot