Thanx, I forgot about TempChild.AsMarkup - this is innerHTMLtext.Use ICEFDomNode.AsMarkup to get the contents of this node as markup.
It may be correct if you rename "AsMarkup" to "innerHTMLtext"?
Thanx, I forgot about TempChild.AsMarkup - this is innerHTMLtext.Use ICEFDomNode.AsMarkup to get the contents of this node as markup.
Code: Select all
procedure StartDOMIteration(const aDocument: ICefDomDocument; const frame: ICefFrame);
var
TempNode, TempChild : ICefDomNode;
msg: ICefProcessMessage;
attrList: TStrings;
InnerHTMLText, val: string;
begin
try
if aDocument <> nil then
begin
TempNode := aDocument.Body;
if TempNode <> nil then
begin
TempChild := TempNode.FirstChild;
while TempChild <> nil do
begin
RecourceDOMIteration(frame, TempChild);
Msg := TCefProcessMessageRef.New(msg_for_chromium);
if TempChild.ElementInnerText = '' then
begin
TempChild := TempChild.NextSibling;
Continue;
end;
msg.ArgumentList.SetString(0, 'name: ' + Trim(TempChild.Name));
msg.ArgumentList.SetString(1, 'TagName: ' + Trim(TempChild.ElementTagName));
attrList := TStringList.Create;
try
TempChild.GetElementAttributes(attrList);
msg.ArgumentList.SetString(2, 'attrList: ' + attrList.CommaText);
finally
attrList.DisposeOf;
end;
InnerHTMLText := Trim(TempChild.AsMarkup);
msg.ArgumentList.SetString(3, 'InnerHTMLText: ' + TempChild.AsMarkup);
val := Trim(TempChild.GetValue);
msg.ArgumentList.SetString(4, 'value: ' + val);
// if TempChild.HasElementAttribute('href') then
// msg.ArgumentList.SetString(4, 'href: ' + Trim(TempChild.GetElementAttribute('href')));
msg.ArgumentList.SetString(5, '**********************');
frame.SendProcessMessage(PID_BROWSER, msg);
TempChild := TempChild.NextSibling;
end;
end;
end;
except
on e : exception do
if CustomExceptionHandler('StartDOMIteration', e) then raise;
end;
end;
procedure RecourceDOMIteration(const frame: ICefFrame; CefDomNode: ICefDomNode);
var
TempChild : ICefDomNode;
msg: ICefProcessMessage;
attrList: TStrings;
InnerHTMLText, val: string;
begin
try
Msg := TCefProcessMessageRef.New(msg_for_chromium);
if CefDomNode <> nil then
msg.ArgumentList.SetString(0, 'RecourceDOMIteration, CefDomNode ' + CefDomNode.Name)
else
msg.ArgumentList.SetString(0, 'RecourceDOMIteration, CefDomNode = nil');
frame.SendProcessMessage(PID_BROWSER, msg);
if CefDomNode <> nil then
begin
TempChild := CefDomNode.FirstChild;
while TempChild <> nil do
begin
RecourceDOMIteration(frame, TempChild);
Msg := TCefProcessMessageRef.New(msg_for_chromium);
if TempChild.ElementInnerText = '' then
begin
TempChild := TempChild.NextSibling;
Continue;
end;
msg.ArgumentList.SetString(0, 'name: ' + Trim(TempChild.Name));
msg.ArgumentList.SetString(1, 'TagName: ' + Trim(TempChild.ElementTagName));
attrList := TStringList.Create;
try
TempChild.GetElementAttributes(attrList);
msg.ArgumentList.SetString(2, 'attrList: ' + attrList.CommaText);
finally
attrList.DisposeOf;
end;
InnerHTMLText := Trim(TempChild.AsMarkup);
msg.ArgumentList.SetString(3, 'InnerHTMLText: ' + TempChild.AsMarkup);
val := Trim(TempChild.GetValue);
msg.ArgumentList.SetString(4, 'value: ' + val);
// if TempChild.HasElementAttribute('href') then
// msg.ArgumentList.SetString(4, 'href: ' + Trim(TempChild.GetElementAttribute('href')));
msg.ArgumentList.SetString(5, '**********************');
frame.SendProcessMessage(PID_BROWSER, msg);
TempChild := TempChild.NextSibling;
end;
end;
except
on e : exception do
if CustomExceptionHandler('RecourceDOMIteration', e) then raise;
end;
end;