如何在html页面中找到“值”的按钮(Webbrowser – Delphi)

前端之家收集整理的这篇文章主要介绍了如何在html页面中找到“值”的按钮(Webbrowser – Delphi)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个html页面,它有3个表单,3个提交按钮.按钮没有名称,但它们有价值:
<input type="submit" VALUE="Login">

如何找到具有其值的按钮并单击它?

谢谢

解决方法

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;
原文链接:https://www.f2er.com/html/232107.html

猜你在找的HTML相关文章