通过木偶机循环表行

我想从表中的每一行获取链接。 这就是我得到第三(例如):

await page.evaluate(() => document.querySelector(#content-tabs-0 > div > table > tbody > tr:nth-child(3) > td.mpt-1-td-desc > a").href) 

我想遍历表行,我使用这样的代码:

 for(let i=1;i<=10;i++){ let link = await page.evaluate(() => document.querySelector("#content-tabs-0 > div > table > tbody > tr:nth-child("+i+") > td.mpt-1-td-desc > a").href); console.log(link); } 

当我执行代码时,我得到这样的错误:

 (node:16928) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Evaluation failed: ReferenceError: i is not defined at <anonymous>:1:87 (node:16928) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 

应该如何正确地完成?

美好的一天你可以得到页面的内容,然后在cheerio的帮助下通过元素并parsing它们。