Mega Code Archive

 
Categories / Delphi / Forms
 

Press a button in a TWebbrowser when there are multiple buttons in the same form

Title: press a button in a TWebbrowser when there are multiple buttons in the same form? // If there is only one button, you can do something like: WebBrowser1.OleObject.Document.forms.item(0).elements.item(0).click; // This will do a click on the first element of the first , where an // element is either , or . // If there is more than one button, you can do something like: procedure TForm1.Button1Click(Sender: TObject); var ovElements: OleVariant; i: Integer; begin ovElements := WebBrowser1.OleObject.Document.forms.item(0).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 = 'Recent Charges') then ovElements.item(i).Click; end;