自动填写IE的网页的输入框的内容

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
dana, 时间:2001-6-3 17:44:52, ID:552324
哇!真给一百分,那就告诉你吧!快给分。
procedure TForm1.PutData;
var
ShellWindow: IShellWindows;
nCount: integer;
spDisp: IDispatch;
i,j,X: integer;
vi: OleVariant;
IE1: IWebBrowser2;
IDoc1: IHTMLDocument2;
iELC : IHTMLElementCollection
S,S2 : string;
HtmlInputEle : IHTMLInputElement;
HtmlSelEle : IHTMLSelectElement;
begin
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;
for i := 0 to nCount - 1 do
begin
vi := i;
spDisp := ShellWindow.Item(vi);
if spDisp = nil then continue;
spDisp.QueryInterface( iWebBrowser2, IE1 );
if IE1 <> nil then
begin
IE1.Document.QueryInterface(IHTMLDocument2,iDoc1);
if iDoc1 <> nil then
begin
ielc:=idoc1.Get_all;
for j:=0 to ielc.length-1 do
begin
Application.ProcessMessages;
spDisp := ielc.item(J, 0);
if SUCCEEDED(spDisp.QueryInterface(IHTMLInputElement ,HtmlInputEle))then
with HtmlInputEle do
begin
S2:=Type_;
S2:=UpperCase(S2);
//我把所有的input都填上 try , checkbox 都打勾
if (StrComp(PChar(S2),'TEXT')=0) or (StrComp(PChar(S2),'PASSWORD')=0) then
value :='try' //S:=S+#9+Value
else if StrComp(PChar(S2),'CHECKBOX')=0 then
begin
checked := True;
end;
end;
if SUCCEEDED(spDisp.QueryInterface(IHTMLselectelement ,HtmlSelEle))then
with HtmlSelEle, Memo1.Lines do
begin
S:=S+#9+IntToStr(selectedIndex+1); //这个是获取数据了
end;
end; //END FOR
Memo2.Lines.Add(S);
exit;
end;
end;
end;
end;
 
 

Similar threads

I
回复
0
查看
549
import
I
I
回复
0
查看
483
import
I
I
回复
0
查看
533
import
I
I
回复
0
查看
836
import
I
后退
顶部