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
querySelectorAll
Hello !
Is it possible to create a variable to extract the content in this way?
document.querySelectorAll('button.pv-top-card-v2-section__link.pv-top-card-v2-section__link-experience span.pv-top-card-v2-section__entity-name')[0].innerText
"TTarga - Carreira e Recolocação"
Is it possible to create a variable to extract the content in this way?
document.querySelectorAll('button.pv-top-card-v2-section__link.pv-top-card-v2-section__link-experience span.pv-top-card-v2-section__entity-name')[0].innerText
"TTarga - Carreira e Recolocação"
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: querySelectorAll
The querySelectorAll method is supported by Chromium.
Use a JavaScript extension like the one in the JSRTTIExtension demo to get the result in Delphi.
Use a JavaScript extension like the one in the JSRTTIExtension demo to get the result in Delphi.
Re: querySelectorAll
Hello!
Sorry, but I can not.
Could you write a sample application code?
Thank you!

Sorry, but I can not.
Could you write a sample application code?
Thank you!

- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: querySelectorAll
You only need to modify the TJSRTTIExtensionFrm.Chromium1ContextMenuCommand procedure.
Replace the line 226 and set testhtml with the querySelectorAll return value.
Replace the line 226 and set testhtml with the querySelectorAll return value.
Re: querySelectorAll
Hello !
I did not make it.
Let's say I want to extract the information from this field from the site
"button.pv-top-card-v2-section__link.pv-top-card-v2-section__link-experience span.pv-top-card-v2-section__entity-name"
Should I report this field somewhere?


Thank you very much for your attention.
I did not make it.
Let's say I want to extract the information from this field from the site
"button.pv-top-card-v2-section__link.pv-top-card-v2-section__link-experience span.pv-top-card-v2-section__entity-name"
Should I report this field somewhere?


Thank you very much for your attention.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: querySelectorAll
The TJSRTTIExtensionFrm.Chromium1ContextMenuCommand procedure would have this code when commandId is MINIBROWSER_CONTEXTMENU_JSVISITDOM :
Notice that I replaced this line in the original code :
Code: Select all
MINIBROWSER_CONTEXTMENU_JSVISITDOM :
if (browser <> nil) and (browser.MainFrame <> nil) then
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);
Code: Select all
'var testhtml = document.body.innerHTML;' +
Re: querySelectorAll
Hello !
Thank you very much, it worked out with the right mouse button.
How could I pass the result straight to an edit?
Thank you very much, it worked out with the right mouse button.
How could I pass the result straight to an edit?
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: querySelectorAll
The TJSRTTIExtensionFrm.Chromium1ProcessMessageReceived procedure saves the text in FText and sends a MINIBROWSER_SHOWTEXTVIEWER message to the form.
TJSRTTIExtensionFrm.ShowTextViewerMsg is executed when the form receives the MINIBROWSER_SHOWTEXTVIEWER message. You only need to set MyEdit.Text := FText; and remove the SimpleTextViewerFrm references from that procedure.
TJSRTTIExtensionFrm.ShowTextViewerMsg is executed when the form receives the MINIBROWSER_SHOWTEXTVIEWER message. You only need to set MyEdit.Text := FText; and remove the SimpleTextViewerFrm references from that procedure.
Re: querySelectorAll
Butto1.onclik.....salvadordf wrote: Wed Dec 05, 2018 8:36 pm The TJSRTTIExtensionFrm.Chromium1ProcessMessageReceived procedure saves the text in FText and sends a MINIBROWSER_SHOWTEXTVIEWER message to the form.
TJSRTTIExtensionFrm.ShowTextViewerMsg is executed when the form receives the MINIBROWSER_SHOWTEXTVIEWER message. You only need to set MyEdit.Text := FText; and remove the SimpleTextViewerFrm references from that procedure.
Edit1.text:= FText;
Re: querySelectorAll
Sorry, but how do you get this result without having to right-click?
I would like to click the button and display the result in the edit. According to the image.

I would like to click the button and display the result in the edit. According to the image.
