0

I need to get the DOM tree of HTML page through webkitgtk, but I'm not familiar with it. Do you know the key functions or any other useful information? Since the source code may contain JS code, the struct of such pages will change when page loading, such as the onload function of javascript. What I want is the rendered DOM tree.

Vector
  • 11
  • 1
  • 5

1 Answers1

0

You can use the DOM-Api to accomplish this:

WebKitDOMDocument* doc = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (web_view));
WebKitDOMElement* root = webkit_dom_document_query_selector (doc, ":root", NULL);
const gchar* content = webkit_dom_html_element_get_outer_html (WEBKIT_DOM_HTML_ELEMENT (root));
Ivaldi
  • 660
  • 6
  • 22