Einzelnen Beitrag anzeigen

XeRo

Registriert seit: 23. Okt 2003
Ort: Warth
461 Beiträge
 
Delphi 7 Enterprise
 
#7

Re: Button einer Web-Seite "drücken" lassen

  Alt 2. Jun 2005, 19:56
Habs jetzt doch mit TWebbrowser gemacht

hab folgendes Script verwendet:

Delphi-Quellcode:
PROCEDURE ClickOnButton(WebBrowser1:TWebBrowser; BT_text:STRING);
VAR
  ovElements,ovFrames: OleVariant;
  i,j,k: Integer;
BEGIN
  IF Webbrowser1.OleObject.Document.Frames.Length > 1 THEN
  BEGIN
        ovFrames := Webbrowser1.OleObject.Document.Frames;
        FOR j := 0 TO (ovFrames.Length - 1) DO
            FOR k := 0 TO (ovFrames.Item(j).Document.Forms.Length - 1) DO
            BEGIN
                ovElements := ovFrames.Item(j).Document.Forms.Item(k).elements;
                FOR i := 0 TO (ovElements.Length - 1) DO
                  IF ((ovElements.Item(i).tagName = 'INPUT')
                    AND (ovElements.Item(i).type = 'submit')
                    AND (ovElements.Item(i).Value = BT_text)) THEN
                        ovElements.Item(i).Click;
            END;
  END
  ELSE
  BEGIN
      FOR j := 0 TO (WebBrowser1.OleObject.Document.forms.Length - 1) DO
      BEGIN
          ovElements := WebBrowser1.OleObject.Document.forms.item(j).elements;
          FOR i := 0 TO (ovElements.Length - 1) DO
              IF ((ovElements.item(i).tagName = 'INPUT')
                AND (ovElements.item(i).type = 'submit')
                AND (ovElements.item(i).Value = BT_text)) THEN
                    ovElements.item(i).Click;
      END;
  END;
END;
Danke @All.
  Mit Zitat antworten Zitat