我有一个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;