0

Is there a way in TChromium to get the output after running a script ? For instance, if i run this script below in Chrome's developer tools :

document.getElementsByTagName('input')

Chrome will output all input nodes in the page. How can i read this output inside Delphi ?

mjn
  • 35,561
  • 24
  • 160
  • 351
delphirules
  • 5,259
  • 13
  • 43
  • 87
  • Are you asking how to access the DOM from DCEF? Did you even google? Or do you want to execute ARBITRARY javascript from DCEF? Either way, are there no tutorials out there that work? What have you tried? This question gives me no indication you tried anything, and that's just lazy. Please edit and improve your question. – Warren P Jan 07 '16 at 20:24
  • @WarrenP i don't open questions without research first. The documentation of DCEF3 is inexistent, so basically your only option is to study the source, and that's what i did to find the solution. Anyway, thank you for being so rude and helpless. – delphirules Jan 08 '16 at 10:33
  • If you did research, then link to what you found. Otherwise, I say you didn't. Here's the CEF wiki. Does it contain any pages that contain what you need? https://bitbucket.org/chromiumembedded/cef/wiki/Home After you understand the basic CEF architecture, then understand the wrapper (DCEF). – Warren P Jan 08 '16 at 13:50

1 Answers1

2

After hours of struggle i found out that there is an event 'OnConsoleMessage' in TChromium ; you can use this event to intercept the script output and all messages in console :

procedure Tform1.webvConsoleMessage(Sender: TObject; const browser: ICefBrowser; const message,
  source: ustring; line: Integer; out Result: Boolean);
begin
end;
delphirules
  • 5,259
  • 13
  • 43
  • 87
  • You are correct that documentation on DCEF appears to have evaporated. In the movement from the pre-google-code DCEF to Google Code days, all DCEF documentation from the old DCEF website seems to have been deleted off the internet. I'm going to have a look in the wayback machine and see what I can rescue. My feeling is you should have consulted the properties inspector before whatever hours you spent struggling. – Warren P Jan 08 '16 at 14:28
  • @WarrenP Thank you for replying. – delphirules Jan 08 '16 at 17:23