I have another problem in retrieving the text of a website.
My application pulls some links from a database, one link at a time, then it runs LoadUrl, next it should retrieve the webpage text and finally move to the next link. The following is the source:
this is the main method where the current link is retrieved from a db and the url is given to Chromium
Code: Select all
function TMainForm.Scan: Boolean;
var a:string;
begin
try
Result := True;
DB.StatisticsOpen;
DB.StatisticsFirst;
while not DB.StatisticEOF do
begin
a:=DB.FindLink;//retrieve link from database table
LoadUrl(a);//open link
DB.StatisticsNext;//next link in database table
end;
except
end;
end;
Code: Select all
function TMainForm.LoadUrl(const a: string): Boolean;
begin
Chromium.LoadURL('http://'+a);
Chromium.RetrieveText;//this does not trigger ChromiumTextResultAvailable
Result:=True;
end;
Code: Select all
procedure TMainForm.ChromiumLoadEnd(Sender: TObject; const browser: ICefBrowser;
const frame: ICefFrame; httpStatusCode: Integer);
begin
if frame = nil then
exit;
if httpStatusCode = 200 then
begin
Chromium.RetrieveText;//this method is not fired
end;
end;
What am I doing wrong ?
Many thanks
Alberto