Flabbergasted Expert Cheater
Reputation: 0
Joined: 11 Oct 2007 Posts: 231 Location: I have alzheimer's.
|
Posted: Tue Jan 27, 2009 3:35 am Post subject: [Help - Delphi] Web Form Filling |
|
|
Hi, this is my code to fill out the first raidobutton for number 1 on http://www.quizjungle.com/?act_id=3&gid=236&pid=84&cid=910&aid=3074&sid=CD7809_2175z683271, but it doesn't work.
| Code: | procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var iDoc: IHtmlDocument2;
i: integer;
ov: OleVariant;
iDisp: IDispatch;
iColl: IHTMLElementCollection;
iInputElement: IHTMLInputElement;
begin
WebBrowser1.ControlInterface.Document.QueryInterface(IHtmlDocument2, iDoc);
if not assigned(iDoc) then begin
ShowMessage(' !!!??? Nothing dowloaded ... ');
Exit;
end;
ov := 'INPUT';
IDisp := iDoc.all.tags(ov);
if assigned(IDisp) then begin
IDisp.QueryInterface(IHTMLElementCollection, iColl);
if assigned(iColl) then begin
for i := 1 to iColl.Get_length do begin
iDisp := iColl.item(pred(i), 0);
iDisp.QueryInterface(IHTMLInputElement, iInputElement);
if assigned(iInputElement) then begin
if iInputElement.Get_name = 'q37_1_1'
then iInputElement.Set_value('1');
end;
end;
end;
end;
end; |
|
|