某个网站它的确定按钮是个image,我用
ov: OleVariant;
ov :=wb.OleObject.document.all.item('Username',0);
ov.Value :='liukang916';
ov := wb.OleObject.document.all.item('Password',0);
ov.Value := '123456';
ov := wb.OleObject.document.all.item('do',0); {找到发送按钮}
ov.Click;
运行了没反应~
UserName和pPassword都运行正常~
do是那个图标的名称,我把那个网页复制到office2000下看的~
ov: OleVariant;
ov :=wb.OleObject.document.all.item('Username',0);
ov.Value :='liukang916';
ov := wb.OleObject.document.all.item('Password',0);
ov.Value := '123456';
ov := wb.OleObject.document.all.item('do',0); {找到发送按钮}
ov.Click;
运行了没反应~
UserName和pPassword都运行正常~
do是那个图标的名称,我把那个网页复制到office2000下看的~
解决方案 »
- 安装Delphi7.0问题出现了问题 求助大家~
- Delphi生成的DLL在VC中怎样调用
- 快速关闭所有窗口!
- 请问Delphi能否处理任意类型的异常?
- list index out of bounds()错误,(关于treeview)!谢谢
- 谁能帮我讲讲Vcl的消息机制
- 怎样才能不按F9而生成.exe文件呢?
- ▓▓▓▓各位大侠请教,关于用BestCrypt v.7加密,但忘记密码,如何办??急急急急急急急急急▓▓▓▓▓
- 有人会写获取网卡MAC号的InstallShield脚本吗?100分!
- 有没有详细论述DELPHI中消息传递的书籍,文章!
- 求MCI控制相关Delphi的源码!
- 怎样向一个动态连接库里面传送一个数据集???
...
wb.OleObject.Document.formname.Submit;
If you have a webpage with a Form on it, but the submit - button is an image,
you can use this code (using a TWebBrowser)
} {
Falls du eine Webpage mit einem Formular hast,
bei welchem der Submit-Knopf ein Bild ist,
dann kannst du diesen Code benutzen (sowie ein TWebBrowser)
} uses
MSHTML; var
iDoc: IHtmlDocument2;
i: integer;
ov: OleVariant;
iDisp: IDispatch;
iColl: IHTMLElementCollection;
InputImage: HTMLInputImage;
begin
WebBrowser1.ControlInterface.Document.QueryInterface(IHtmlDocument2, iDoc);
if not Assigned(iDoc) then
begin
Exit;
end;
ov := 'INPUT';
iDisp := iDoc.all.tags(ov);
if Assigned(IDisp) then
begin
IDisp.QueryInterface(IHTMLElementCollection, iColl);
if Assigned(iColl) then
begin
for i := 1 to iColl.Get_length do
begin
iDisp := iColl.item(pred(i), 0);
iDisp.QueryInterface(HTMLInputImage, InputImage);
if Assigned(InputImage) then
begin
if InputImage.Name = 'submit' then
// if the name is submit / falls der name submit lautet
begin
InputImage.Click; // click it / klick es
end;
end;
end;
end;
end;
end; // 2. procedure TForm1.Button1Click(Sender: TObject);
var
i: Word;
Document: IHtmlDocument2;
str: string;
begin
// Schleife über alle Bilder im Webbrowser
for i := 0 to WebBrowser1.OleObject.Document.Images.Length - 1 do
begin
Document := WebBrowser1.Document as IHtmlDocument2;
// URL auslesen
Str := (Document.Images.Item(i, 0) as IHTMLImgElement).Href;
// Dateiname des Bildes überprüfen
if Pos('submit_icon.gif', str) <> 0 then
begin
((Document.Images.Item(i, 0) as IHTMLImgElement) as IHTMLElement).Click;
end;
end;
end;
找到那个image的名字,如<input type="image' src="..." name="aimg">
ov := wb.OleObject.document.all.item('aimg',0);
ov.click;
是个image,所以
ov := wb.OleObject.document.all.item('aimg',0);
ov.click;
运行了是没有反映的,必须把0改称1
ov := wb.OleObject.document.all.item('aimg',1);
我看的是Delphi英文的Helper也没理解的太清楚,只知道这么做就可以了~