Having problem getting page document

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Having problem getting page document

Postby Aradzulti » Thu Dec 01, 2016 7:14 am

'm using in my project Cefsharp. I want to get the html source of a page after the page done loading. So Im using this code:

private void WebBrowserFrameLoadEnded(object sender, FrameLoadEndEventArgs e)
{
if (e.Frame.IsMain)
{
//chromeBrowser.ViewSource();
chromeBrowser.GetSourceAsync().ContinueWith(taskHtml =>
{
var html = taskHtml.Result;
});
}
}
And I saw that the line "chromeBrowser.ViewSource();" opens me a notepad with the source file. But I don't get the same "file"/text in my html variable. I would like to get what Im getting from the ViewSource() and not from GetSourceAsync().
For example this page:
https://www.shazam.com/track/324443962/closer
How can I do that?
Aradzulti
Newbie
 
Posts: 1
Joined: Thu Dec 01, 2016 7:11 am

Re: Having problem getting page document

Postby stplajay » Tue Jan 31, 2017 11:14 pm

I am also looking an approach to get the source html but not found any proper solution. Please share if you found at your end.
stplajay
Newbie
 
Posts: 1
Joined: Tue Jan 31, 2017 11:04 pm

Re: Having problem getting page document

Postby amaitland » Mon Feb 06, 2017 1:06 am

You'll likely need to dig through the CEF source. My guess is it's a timing issue. You can add a delay after the page has loaded before attempting to access the source and see if you get a different result.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 67 guests