html – How to handle iframes on a webpage-ThrowExceptions

Exception or error:

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.



Google-doc to get more details of my task.

How to solve:

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),

Leave a Reply

Your email address will not be published. Required fields are marked *