Ping!
he encontrado el código,...pero no me funciona (ya mas o menos voy teniendo idea)
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
begin
if not FillForm(WebBrowser1, 'login', 'jaimito') then
ShowMessage('Error: field LOGIN not found on page')
else begin
if not FillForm(WebBrowser1, 'password', 'soytupassword') then
ShowMessage('Error: field PASSWORD not found on page')
else begin
if not FillForm(WebBrowser1, 'paja', 'activated') then
ShowMessage('Error: field PAJA not done!');
end;
end;
end;
function TForm1.FillForm(WB: TWebBrowser; FieldName, Value: string): Boolean;
var
FormNr, ItemNr: integer;
TheForm: Variant;
begin
Result := False;
if WB.OleObject.Document.All.Tags('FORM').Length = 0 then begin
ShowMessage('Error: no FORM found on page');
Exit;
end;
for FormNr := 0 to WB.OleObject.Document.Forms.Length - 1 do begin
TheForm := WB.OleObject.Document.Forms.Item(FormNr);
for ItemNr := 0 to WB.OleObject.Document.Forms.Item.length - 1 do
try
if TheForm.Item(ItemNr).Name = FieldName then begin
TheForm.Item(ItemNr).Value := Value;
Result := True;
end;
except
Break;
end;
if Result then Break;
end;
if Result then Break;
end;
end;
y sin embargo, compilando me salen chorrocientos de errores
[Error] Unit1.pas(28): E2003 Undeclared identifier: 'FillForm'
[Error] Unit1.pas(33): E2003 Undeclared identifier: 'Result'
[Error] Unit1.pas(35): E2003 Undeclared identifier: 'WB'
[Error] Unit1.pas(40): E2029 'DO' expected but identifier 'OleObject' found
[Error] Unit1.pas(41): E2066 Missing operator or semicolon
[Error] Unit1.pas(41): E2066 Missing operator or semicolon
[Error] Unit1.pas(43): E2029 'DO' expected but identifier 'OleObject' found
[Error] Unit1.pas(46): E2003 Undeclared identifier: 'FieldName'
[Error] Unit1.pas(47): E2003 Undeclared identifier: 'Value'
[Error] Unit1.pas(57): E2097 BREAK or CONTINUE outside of loop
[Error] Unit1.pas(59): E2029 '.' expected but ';' found
[Error] Unit1.pas(66): E2003 Undeclared identifier: 'FillForm'
[Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas'
(no....no tengo ni p*ta idea de Delphi, estoy en pañales
)