Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
querySelectorAll
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: querySelectorAll
You can create a button, use the onclick event and call Chromium.ExecuteJavaScript with the same parameters that you see in TJSRTTIExtensionFrm.Chromium1ContextMenuCommand
Re: querySelectorAll
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;
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: querySelectorAll
Try using different message names and modify the TJSRTTIExtensionFrm.Chromium1ProcessMessageReceived procedure to handle them.
If that fails, try executing the JavaScript functions one after the other, not all at the same time.
If that fails, try executing the JavaScript functions one after the other, not all at the same time.