I am trying to access the DOM (html document object information) from delphi, using the delphi embedded chrome web browser component. For example, let's say I needed to obtain the current attributes of an html item in the browser such as its position or width.
From what I can tell I need to access ICefDomDocument interface, and function GetDocument in that interface returns ICefDomNode. There is also function GetElementById returning ICefDomNode
However, how do I obtain the ICefDomDocument from a browser component dropped on form1? It's not obvious how one accesses the interface.
What I want to do is, say I have a DIV box with some attributes such as
<div id="box1" width="40px"> </div>
I want from delphi to find out the width of div box with an id, or name, of box1. This should be trivial however I can't figure out how to actually access the interface if a browser is dropped on the form. ICefBrowser interface is accessible by:
Chromium1.Browser
However where do I go from there? I can't find how to obtain the dom info from the browser, or access the other ICefDomDocument or ICefDomNode.
I am using Delphi Berlin (10) however it shouldn't matter.
Also if the document is using javascript, is it possible to obtain the latest div box width even if it was modified by javascript code later... i.e. if someone pressed a button and changed the width of the div box, I assume the DOM info will show the latest width of DIV and not the original hardcoded.
Thanks much