Cefsharp: How to get current page source code?

Created on 14 Sep 2012  路  8Comments  路  Source: cefsharp/CefSharp

How to get the current page source code as string from my webview control?

Most helpful comment

You can use a bit of javascript...

    webView.EvaluateScript(@"document.getElementsByTagName ('html')[0].innerHTML").ToString();

All 8 comments

This is not currently available in CefSharp

but the "CefSharp Windows Forms Example" can show the source code using the context menu, is there a way to pass this result (src**.txt) to string?

You can use a bit of javascript...

    webView.EvaluateScript(@"document.getElementsByTagName ('html')[0].innerHTML").ToString();

well done fix by bling is working abbulkmailer.com
any way to click links

Is this still not possible except by using the javascript hack above?
I ask cause I'm trying to read a huge page html and through javascript it hangs for more than a minute.

Thanks

Ouch, I should have checked all methods and parameters before asking.

If you don't mind me asking is there a solution to get the source of a specific frame on the page? In my case I need to grab the source from the third frame on the page to parse some values using htmlagilitypack.

Thanks a lot man.

If you don't mind me asking is there a solution to get the source of a specific frame on the page? In my case I need to grab the source from the third frame on the page to parse some values using htmlagilitypack.

In the current version no, it's limited to the main frame.

Next version (master branch) is a major rewrite, as part of that there's access to the individual frames.

https://github.com/cefsharp/CefSharp/blob/master/CefSharp/IFrame.cs#L66

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dinoc picture dinoc  路  40Comments

amaitland picture amaitland  路  34Comments

arvindlloyds picture arvindlloyds  路  25Comments

nico87 picture nico87  路  46Comments

8 picture 8  路  39Comments