Page 1 of 1

Re: Get html code with line breaks

Posted: Fri Apr 27, 2018 1:59 pm
by salvadordf
CEF4Delphi doesn't change the string returned by CEF when you call TChromium.RetrieveHTML. It seems that Chromium returns "cleaner" HTML.

By cleaner I mean that the rendering engine collapses whitespace as the CSS specs dictate. The rendering results are exactly the same if the raw HTML has some extra CRLF sequences or consecutive spaces in some places.

Try the JSExtension demo and use the "Visit DOM in JavaScript" option in the context menu. JavaScript seems to keep more line breaks in the HTML results.

Re: Get html code with line breaks

Posted: Fri Apr 27, 2018 2:44 pm
by salvadordf
The DevTools shows the DOM nodes in a tree structure. It doesn't show the original HTML. It only adds all the DOM nodes to the tree.
Compare the raw HTML from google.com with the tree nodes shown in the DevTools to see the difference. ;)

If you need the raw HTML code then use the "Visit DOM in JavaScript" option in the JSExtension demo as I mentioned before.

Re: Get html code with line breaks

Posted: Fri Apr 27, 2018 3:47 pm
by salvadordf
Please, download CEF4Delphi again and try the new context menu option in the DOMVisitor demo called "Visit DOM in CEF (BODY HTML)". It will copy the HTML inside the body element to the clipboard.

The JSExtension demo can also be used to get the HTML by using the "Visit DOM in JavaScript" option in the context menu.