我刚刚开始学习语法分析,遇到了一个问题.我可能误解了什么或写了什么,但我不明白是什么
const puppeteer = require(`puppeteer`);
(async () => {
const browser = await puppeteer.launch({headless:false})
const page = await browser.newPage()
await page.goto('https://www.agsvyazi.ru/beeline/numbers/index.page.0.htm',{waitUntil: 'load'})
let pages = 131;
let idx = 0;
const allPhns = [];
while(pages > idx){
await new Promise(resolve => setTimeout(resolve, 3000));
let arr = await page.evaluate(() => {
let elem = Array.from(document.querySelectorAll("div.fl.number-table"), el => el.innerText)
return elem
})
allPhns.push(...arr)
// hrefPer = document.querySelector('div.listing a:last-child').href
//await page.goto(document.querySelector('div.listing a:last-child').href)
await page.goto(document.querySelector('div.listing a:last-child').href, {waitUntil: 'load'})
idx +=1
}
console.log(allPhns)
})()
我同时try 了Page.goto和Page.Click.我在元素的代码中搜索了很多,try 了querySelector()和querySelectorAll()不同的"路径".我不明白问题出在哪里