Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Delphi inject to a website using TWebbrowser and extract data


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Steve Warburton

Posts: 1
Registered: 7/19/05
Delphi inject to a website using TWebbrowser and extract data  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 11, 2016 3:50 AM
I am testing using www.gumtree.co.uk and I can then move onto other sites.

I have managed to change the search terms and post code then click the go button with the following code:

procedure TForm1.WebBrowser1DocumentComplete(ASender: TObject;
const pDisp: IDispatch; const URL: OleVariant);
begin
documentComplete := true;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin

WebBrowser1.OleObject.Document.getElementByID('header-search-location').Value:='OL66HE';
WebBrowser1.OleObject.Document.getElementByID('header-search-q').Value:='Dewalt';

end;

procedure TForm1.Button3Click(Sender: TObject);
var
ovElements: OleVariant;
i: Integer;
begin

if not documentComplete then
begin
showmessage('Not loaded yet');
end

else

begin
ovElements := WebBrowser1.OleObject.Document.all;
for i := 0 to (ovElements.Length - 1) do
if (ovElements.item(i).className = 'btn-primary btn-icon') then //be aware that it must be written with the exact case className
ovElements.item(i).Click;
end;
end;
So far so good.

I now want to extract the data in the following class

    I'm not to hot on all the different elements of HTML but am I right in assuming this is an unordered list ?

    How do I extract the following:

    Image url listing-title listing-description listing-price etc

    Ideally I would like to have a routine to extract all the elements then I can fine tune the data later.

    Cheers

    Steve Warby.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02