Get HTML Source from Chromium Embedded

后端 未结 2 1371
悲哀的现实
悲哀的现实 2020-12-10 06:13

How to do this with Delphi Chromium Embedded Component i know how to do this with TWebBrowser. But since no docs are present for this I am sure someone else had same problem

相关标签:
2条回答
  • 2020-12-10 06:54

    in dcef 3

    procedure StringVisitor(const str: ustring);
    begin
      //str is the SourceHtml
    showmessage(str);
    end;
    
    function GetSourceHTML: string;
    var
    CefStringVisitor:ICefStringVisitor;
    begin
      CefStringVisitor := TCefFastStringVisitor.Create(StringVisitor);
      Chromium1.Browser.MainFrame.GetSource(CefStringVisitor);
    end;
    
    0 讨论(0)
  • 2020-12-10 06:58

    Here is how you do it..

    procedure TCustomLoad.OnLoadEnd(const browser: ICefBrowser;
      const frame: ICefFrame; httpStatusCode: Integer);
      var
      data:tstringlist;
    begin
      data:=tstringlist.create;
      if frame.IsMain then
      data.text:=frame.Source; // HTML Source    
    end;
      data.free;
    end;
    
    0 讨论(0)
提交回复
热议问题