Re: querySelectorAll
Posted: Thu Dec 06, 2018 8:43 am
You can create a button, use the onclick event and call Chromium.ExecuteJavaScript with the same parameters that you see in TJSRTTIExtensionFrm.Chromium1ContextMenuCommand
The forum for BriskBard users and CEF4Delphi / WebView4Delphi / WebUI4Delphi / WebUI4CSharp developers
http://www.briskbard.com/forum/
Code: Select all
//School
chromium1.Browser.MainFrame.ExecuteJavaScript('var testhtml = document.querySelectorAll(' + quotedstr('button.pv-top-card-v2-section__link.pv-top-card-v2-section__link-education span.pv-top-card-v2-section__entity-name') + ')[0].innerText;' +
'myextension.sendresulttobrowser(testhtml, ' + quotedstr(CUSTOMNAME_MESSAGE_NAME) + ');', // This is the call from JavaScript to the extension with DELPHI code in uTestExtension.pas
'about:blank', 0);
//email
chromium1.Browser.MainFrame.ExecuteJavaScript('var testhtml = document.querySelectorAll(' + quotedstr('section.pv-contact-info__contact-type.ci-email a.pv-contact-info__contact-link') + ')[0].innerText;' +
'myextension.sendresulttobrowser(testhtml, ' + quotedstr(CUSTOMNAME_MESSAGE_NAME) + ');', // This is the call from JavaScript to the extension with DELPHI code in uTestExtension.pas
'about:blank', 0);
//Company
chromium1.Browser.MainFrame.ExecuteJavaScript('var testhtml = document.querySelectorAll(' + quotedstr('button.pv-top-card-v2-section__link.pv-top-card-v2-section__link-experience span.pv-top-card-v2-section__entity-name') + ')[0].innerText;' +
'myextension.sendresulttobrowser(testhtml, ' + quotedstr(CUSTOMNAME_MESSAGE_NAME) + ');', // This is the call from JavaScript to the extension with DELPHI code in uTestExtension.pas
'about:blank', 0);
salvadordf wrote: Thu Dec 06, 2018 8:43 am You can create a button, use the onclick event and call Chromium.ExecuteJavaScript with the same parameters that you see in TJSRTTIExtensionFrm.Chromium1ContextMenuCommand
Code: Select all
procedure TJSRTTIExtensionFrm.ShowTextViewerMsg(var aMessage : TMessage);
begin
// This form will show the HTML received from JavaScript
{SimpleTextViewerFrm.Memo1.Lines.Text := FText;
SimpleTextViewerFrm.ShowModal;}
edit2.Text:= School;
edit3.Text:= Company;
edit4.Text:= Email;
end;
Code: Select all
protected
School: string;
Empresa : string;
Email : string;