简体   繁体   English

如何处理网页上的iframe

[英]How to handle iframes on a webpage

I want to get the HTML source of the iframe present on the webpage . 我想获取网页上存在的iframe的HTML源代码。 I am using chromedp package with Go. 我在Go中使用chromedp软件包。 How to handle the iframes with chromedp package? 如何使用chromedp包处理iframe? The documentation is very less so couldn't find a way. 该文档很少,因此找不到方法。

Links: 链接:

chromedp chromedp

Google-doc to get more details of my task. Google文档可获取有关我的任务的更多详细信息。

After many attempts, Finally, I found the way and solved my query. 经过多次尝试,最终,我找到了解决方法并解决了我的查询。 You can check my GitHub repository for this query. 您可以在我的GitHub存储库中查询此查询。 Thank you. 谢谢。 To get the iframe contents we can use Javascript. 要获取iframe内容,我们可以使用Javascript。 Way to do it with chromedp is as below, 使用chromedp的方法如下

cdp.EvaluateAsDevTools("document.getElementById('IFRAME-ID').contentWindow.document.body.outerHTML;", RESULT-BUFFER),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM