最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

puppeteer - access cdp from client - Stack Overflow

programmeradmin0浏览0评论

Without having read too much about cdp (only the main cdp page and the getting started guide) - is it possible at all to get a nodeId on the client?

My use case would be roughly this

const handle = elementHandleFromNodeId(await page.evaluate(() => {
  return getNodeIdOfElementSomehow(document.getElementById("test-id"));
});

And yes, I am fully aware of the fact that I can just do page.$("#test-id") but that's not what I want to do. The full use case is a bit too large for a SO question.

My current workaround involves setting a unique data* attribute and querying that on the backend but if possible at all I'd like to avoid that.

发布评论

评论列表(0)

  1. 暂无评论