views:

87

answers:

1

Hi , i have a html page that it have 3 forms with 3 submit buttons . buttons have no name but they have value :

<input type="submit" VALUE="Login">

How can i find this button with its value and click on it ?

Thanks

+3  A: 
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 = 'Login') then
      ovElements.item(i).Click; 
end;
SimaWB