Autor Beitrag
JoachimQ
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 59


D2, D6 und D7
BeitragVerfasst: Sa 27.08.05 18:46 
Hallo!

Ich habe jetzt die MozillaBrowser Komponente installiert.
Ich möchte eine Webseite laden (Navigate('...')) und dann
anschließen Felder wie Login und Password ausfüllen lassen
ohne eine Taste gedrückt zu haben. Dies gelingt mir bis jetzt
nur bei der TWebBrowser Komponente (Internet Explorer).
Weiß jemand wie man die sogannte Fillform Procedure so umschreiben
kann das sie mit der Mozilla Komponente funktioniert?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
function FillForm(WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean;
var
  i, j: Integer;
  FormItem: Variant;
begin
  Result := False;
  //no form on document
  if WebBrowser.OleObject.Document.all.tags('FORM').Length = 0 then
  begin
    Exit;
  end;
  //count forms on document
  for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do
  begin
    FormItem := WebBrowser.OleObject.Document.forms.Item(I);
    for j := 0 to FormItem.Length - 1 do
    begin
      try
        //when the fieldname is found, try to fill out
        if FormItem.Item(j).Name = FieldName then
        begin
          FormItem.Item(j).Value := Value;
          Result := True;
        end;
      except
        Exit;
      end;
    end;
  end;
end;


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.