use*_*421 3 javascript node.js async-await puppeteer
我的代码有错误,所以我尝试在错误代码中记录该值。所以我做了:
const read = await page.$$('.Ns6lhs9 _gfh3').length;
Run Code Online (Sandbox Code Playgroud)
然后我 console.log(read);
出于某种原因,undefined
尽管'Ns6lhs9 _gfh3'
HTML 中有带有类名的元素,但我得到了
$$
返回一个元素的承诺,虽然length
不是承诺,但它是实际值。
它应该是:
const read = (await page.$$('.Ns6lhs9._gfh3')).length;
Run Code Online (Sandbox Code Playgroud)