I only have a Delphi 10.3 Community Edition license and I can't test other Delphi versions but I tested the MiniBrowser again in Delphi and Lazarus 2.0.2 and the menu function to copy the HTML to the clipboard works correctly.
Each Delphi version has its own set of issues, especially with interfaces, so let's try a few things :
- Set a breakpoint in the line where you call "RetrieveHTML".
- Set another breakpoint in TCustomCefStringVisitor.Visit : https://github.com/salvadordf/CEF4Delph ... r.pas#L153
- Run your application and execute the function to get the HTML source.
- Delphi will stop in the "RetrieveHTML". Press the F7 key to "step into" that function.
- Go step by step and check that "Initialized" returns true and FBrowser.MainFrame returns a valid interface (not nil)
- If Delphi reaches the TempFrame.GetSource(TempVisitor) line then the second breakpoint should be reached and the TChromium.OnTextResultAvailable should be triggered
- "Initialized" returns False : Check that the browser is fully created and the web page loaded before calling the RetrieveHTML function
- FBrowser.MainFrame returns nil : Replace it with FBrowser.GetMainFrame
- if TempFrame.GetSource(TempVisitor) is executed but the event is not triggered then try replacing the TChromium.RetrieveHTML procedure with the following code :
Code: Select all
procedure TChromium.RetrieveHTML(const aFrameName : ustring); var TempFrame : ICefFrame; TempVisitor : ICefStringVisitor; begin if Initialized then begin if (length(aFrameName) > 0) then TempFrame := FBrowser.GetFrame(aFrameName) else TempFrame := FBrowser.MainFrame; if (TempFrame <> nil) then try TempVisitor := TCustomCefStringVisitor.Create(self); TempFrame.GetSource(TempVisitor); finally TempVisitor := nil; end; end; end;