Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I got tChromium to work under Delphi 7, it should all work the same.</p> <p>There are the steps I took to read elements from the DOM</p> <p>First I got a wrapper from this project: <a href="https://code.google.com/p/delphichromiumembedded/downloads/detail?name=dcef-r306.7z&amp;can=2&amp;q=" rel="nofollow">https://code.google.com/p/delphichromiumembedded/downloads/detail?name=dcef-r306.7z&amp;can=2&amp;q=</a></p> <p>There is also one for XE2, would not take much to convert that to XE3, if you need help with that I will gladly help on request.</p> <p>Then declare a begin and end in the tchromium</p> <pre><code>procedure TMainForm.crmLoadStart(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame); begin if (browser &lt;&gt; nil) and (browser.GetWindowHandle = crm.BrowserHandle) and ((frame = nil) or (frame.IsMain)) then FLoading := True; end; </code></pre> <p>,</p> <pre><code>procedure TMainForm.crmLoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer; out Result: Boolean); begin if (browser &lt;&gt; nil) and (browser.GetWindowHandle = crm.BrowserHandle) and ((frame = nil) or (frame.IsMain)) then begin FLoading := False; // see if loaded while(httpStatusCode &lt;&gt; 200) do begin Application.ProcessMessages; Sleep(50); end; browser.GetMainFrame.VisitDomProc(DomProc); end; end; </code></pre> <p>Declare a procedure called domproc like so:</p> <pre><code>procedure DomProc(const Doc: ICefDomDocument); var Node: ICefDomNode; begin url := Doc.BaseUrl; if(url='www.goodwebsite.com') then // check if it is the right page and not add Node := Doc.Body.Document.GetElementById('idofwhatyouarelookingfor'); Node.SetElementAttribute('value','Hello world :D'); end; </code></pre> <p>That was the most reliable way i have found so far, you need to make sure the page is well loaded and that you are getting the dom for the right frame.</p> <p>Hope it helps you, make sure to check out the example code in the download link above, that helped me out a lot.</p> <p>Have fun coding, Delphi rocks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload