TWebBrowser打开的页面中,如何用程序填写页面中输入框的内容,然后再用程序模拟提交的动作 TWebBrowser打开的页面中,如何用程序填写页面中输入框的内容,然后再用程序模拟提交的动作 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TForm1.Button1Click(Sender: TObject);var Docs, ovElements: OleVariant; i: integer;begin WebBrowser1.Navigate('http://www.csdn.net/member/login.asp'); while WebBrowser1.ReadyState < READYSTATE_COMPLETE do Application.ProcessMessages; Docs := WebBrowser1.OleObject.Document;//-- <input name=login_name ID="login_name"> ovElements := Docs.GetElementByID('login_name'); ovElements.Value :='your_UserName';//-- <input type=password name=password ID="password"> ovElements := Docs.GetElementByID('password'); ovElements.Value :='your_Password';//-- <input type="image" src="/member/images/go.gif"> ovElements := WebBrowser1.OleObject.Document.all.tags('INPUT'); for i := 0 to (ovElements.Length - 1) do if UpperCase(ovElements.item(i).type) = 'IMAGE' then ovElements.item(i).Click;end;説明:在上述SOURCE中、輸入NI在CSDN的用户名和密码(或在网页中輸入) 按「Button1」模擬网页中的動作。 TreeView上的一个节点拖下来,放到GroupBox里面 说句实话 我越来越不了解Delphi了 TstringList里面的内容按降序排列 已知一个窗体的名,如果去创建这个窗体,注意只知道窗体名是字符类型! 急! adotable降序后如何在dbgrid中显示前三条记录呢? 小弟刚刚写了一个贪吃蛇,但是遇到一些问题,现发布源程序,和大家交流 套打问题,很急 DELPHI6怎么经常出现RTL60.BPL 错误? 如何获知在StringGrid里边写的文字一共多长? 兄弟们支持一下小弟做的网站好不! 我想察看一下程序都调用了那些dll,有这样的程序么?
var
Docs, ovElements: OleVariant;
i: integer;
begin
WebBrowser1.Navigate('http://www.csdn.net/member/login.asp');
while WebBrowser1.ReadyState < READYSTATE_COMPLETE do
Application.ProcessMessages; Docs := WebBrowser1.OleObject.Document;
//-- <input name=login_name ID="login_name">
ovElements := Docs.GetElementByID('login_name');
ovElements.Value :='your_UserName';
//-- <input type=password name=password ID="password">
ovElements := Docs.GetElementByID('password');
ovElements.Value :='your_Password';//-- <input type="image" src="/member/images/go.gif">
ovElements := WebBrowser1.OleObject.Document.all.tags('INPUT');
for i := 0 to (ovElements.Length - 1) do
if UpperCase(ovElements.item(i).type) = 'IMAGE' then
ovElements.item(i).Click;
end;説明:在上述SOURCE中、輸入NI在CSDN的用户名和密码(或在网页中輸入)
按「Button1」模擬网页中的動作。