【发布时间】:2019-12-09 02:44:34
【问题描述】:
好的,所以我试图用 node.js puppeteer 抓取的页面是这样的结构
<html lang = "en">
....
<html xmlns="https://www.w3.org/1999/xhtml" lang="en">
<a href = "link I'm trying to go to">Go to link</a>
</html>
</html>
我尝试通过选择器和 XPath 进行单击。两者都不起作用,我三次检查两者是否正确。感觉跟这个内嵌的html有点关系,不知道怎么处理?有人可以帮忙吗?
【问题讨论】:
-
是在
iframe里面吗? -
到目前为止你有什么尝试?
-
正如@MarcosCasagrande 暗示的那样,如果您要抓取的内容在 iframe 内,则需要抓取 iframe 的 URL,因为 iframe 内容的 DOM 元素不可访问来自父文档。
-
@MarcosCasagrande 是的,它在 iframe 内。让我尝试抓取 iframe 的 url
-
@MichaelRodriguez 是的,它在 iframe 中。我将尝试抓取该网址
标签: javascript html node.js puppeteer