使用TWebBrowser登录到Web [英] Login to web using TWebBrowser
本文介绍了使用TWebBrowser登录到Web的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用网页
How do I press the login button using TWebBrowser
on the web page "https://v-tri.tri.co.id:8434/insms/dealer/en/loginin.do" using Delphi7 ?
procedure TForm1.Open_webClick(Sender: TObject);
begin
webbrowser1.Navigate('v-tri.tri.co.id:8434/insms/dealer/en/loginin.do');
end;
procedure TForm1.InputClick(Sender: TObject);
begin
WebBrowser1.OleObject.Document.GetElementByID('UserName').setAttribute('value', edit1.Text );
WebBrowser1.OleObject.Document.GetElementByID('PassWord').setAttribute('value', edit2.Text );
end;
procedure TForm1.LoginClick(Sender: TObject);
begin
//WebBrowser1.OleObject.Document ... ??
end;
推荐答案
您已经有代码来查找和填写网络表单编辑字段。使用类似的代码找到登录按钮的元素并调用其 click()
方法,或者找到Webform本身的元素并调用其 submit ()
方法。
You already have code to locate and fill in the webform edit fields. Use similar code to locate the element of the login button and call its click()
method, or locate the element of the webform itself and call its submit()
method.
这篇关于使用TWebBrowser登录到Web的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文