Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find a button with "value" in html page (Webbrowser - Delphi)

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

like image 504
Kermia Avatar asked Dec 13 '25 18:12

Kermia


1 Answers

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;
like image 62
SimaWB Avatar answered Dec 15 '25 08:12

SimaWB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!