I can't figure out why this piece of code not working:
var stock;
var stockEL = await page.$eval('.qty tbody tr td:nth-of-type(1) span');
if ( stockEL !== null) {
stock = stockEL.getAttribute('data-tip');
}
I am trying to use in Puppeteer. I would like to check if a span of first td exists, if yes, read the span attribute, if not exists do nothing.
Error: Error: failed to find element matching selector ".qty tbody tr td:nth-of-type(1) span"