Bien m'sieur :
function RempliFormulaire:boolean;
var
iDoc: IHtmlDocument2;
i: integer;
ov: OleVariant;
iDisp: IDispatch;
iColl: IHTMLElementCollection;
iInputElement: IHTMLInputElement;
inputelement: HTMLInputButtonElement;
begin
form1.WebBrowser1.ControlInterface.Document.QueryInterface(IID_IHTMLDocument, iDoc);
if not assigned(iDoc) then
begin
ShowMessage('Erreur à la connexion ...');
Exit;
end;
ov := 'INPUT';
IDisp := iDoc.all.tags(ov);
if assigned(IDisp) then
begin
IDisp.QueryInterface(IID_IHTMLElementCollection, iColl);
if assigned(iColl) then
begin
for i := 1 to 4 do
begin
iDisp := iColl.item(pred(i), 0);
iDisp.QueryInterface(IID_IHTMLInputElement, iInputElement);
if assigned(iInputElement) then
begin
if ((iInputElement.type_='text') or (iInputElement.name='user')) and (i=1) then
begin
iInputElement.value:= 'monID';
end;
if (iInputElement.type_= 'password') or (iInputElement.name='password') or (iInputElement.name='') then
begin
iInputElement.value:= 'monMDP';
end;
if (iInputElement.type_='checkbox') then
begin
iInputElement.checked:=true; //or (iInputElement.name='cond')
end;
end;
end;
end;
end;
form1.Webbrowser1.OleObject.Document.Links.Item(3).click; // clique sur le liens de connexion
end;
voilà, c'est ma fonction qui rempli le formulaire et clique sur le lien qui envoie le formulaire...
C'est grave docteur ? 