htmlgoiframeweb-scrapingchromedp

How to handle iframes on a webpage


I want to get the HTML source of the iframe present on the webpage. I am using chromedp package with Go. How to handle the iframes with chromedp package? The documentation is very less so couldn't find a way.

Links:

chromedp

Google-doc to get more details of my task.


Solution

  • After many attempts, Finally, I found the way and solved my query. You can check my GitHub repository for this query. Thank you. To get the iframe contents we can use Javascript. Way to do it with chromedp is as below,

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