首页 > 解决方案 > Puppeteer waitForSelector('selector') 是否仅适用于字符串而不适用于 page.$('selector')?

问题描述

我正在使用 Puppeteer 3.0.2

我像这样存储我的定位器-> const ele = await page.$('.asd')

这似乎不起作用-> waitForSelecttor(ele, { visible:true })

我不想使用这样的字符串->

常量 ele = '.asd'

waitForSelecttor(ele,{可见:真})

我想对所有内容都使用一个选择器,而不是字符串和 a-> const ele = await page.$('.asd')

即使我必须创建一个函数来做同样的事情。

我怎样才能做到这一点?

标签: selectorpuppeteerwait

解决方案


推荐阅读