Access DOM in CefRenderProcessHandler::OnContextCreated

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.

Access DOM in CefRenderProcessHandler::OnContextCreated

Postby Arie » Tue Mar 03, 2015 9:19 am

Hi,

I can successfully access the DOM in the OnProcessMessageReceived() callback with something like this:

Code: Select all
bool RendererHandler::OnProcessMessageReceived(CefRefPtr<CefBrowser> paBrowser, CefProcessId aSourcePid, CefRefPtr<CefProcessMessage> paMessage)
{
    paBrowser->GetMainFrame()->VisitDOM(new DomVisitor);
}


But when I am trying the same thing in the OnContextCreated callback, the CefDOMDocument appears empty.

Code: Select all
void RendererHandler::OnContextCreated(CefRefPtr<CefBrowser> paBrowser, CefRefPtr<CefFrame> paFrame, CefRefPtr<CefV8Context> paContext)
{
    paBrowser->GetMainFrame()->VisitDOM(new DomVisitor);
    paFrame->VisitDOM(new DomVisitor);
}


So, my question is: Is it possible to access DOM in OnContextCreated() or the DOM is not available at this time ?

Thanks.
Arie
Newbie
 
Posts: 7
Joined: Tue Jul 15, 2014 4:23 am

Re: Access DOM in CefRenderProcessHandler::OnContextCreated

Postby magreenblatt » Tue Mar 03, 2015 1:00 pm

Arie wrote:Is it possible to access DOM in OnContextCreated() or the DOM is not available at this time ?

The DOM is not available at that time. See https://code.google.com/p/chromiumembed ... il?id=1454.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 94 guests