Hello,
For TAdvWebBrowser component, do we have any events or methods from which we can access the contents of the page which is currently opened in TAdvWebBrowser?
Is it possible to access the webpage div elements and HTML input elements with values?
Thank You.
Hi,
There is currently no DOM access, we are looking for a way to expose this. You can access all elements and their values with the ExecuteJavaScript method, and document.getElementByID. See this sample below:
uses
JSON;
procedure TForm48.Button1Click(Sender: TObject);
begin
AdvWebBrowser1.ExecuteJavascript('function GetHTML(){return unescape(document.documentElement.innerHTML);} GetHTML();',
procedure(const AValue: string)
begin
memo1.Lines.Text := TJSONObject.ParseJSONValue(AValue).Value;
end
);
end;