在TWebbrowser 中模拟点击一个提交按钮
2008-10-04 23:00
218 查看
http://www.delphibbs.com/keylife/iblog_show.asp?xid=1316
//------------------------------------------------------------------------------------------------------------------------
uses
MSHTML; //必须引用这个单元
var
iDoc: IHtmlDocument2;
i: integer;
ov: OleVariant;
iDisp: IDispatch;
iColl: IHTMLElementCollection;
InputImage: HTMLInputImage;
//-----------------form http://blog.csdn.net/laoli/----------------------
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 = '提交 then
// ---------------------------------------如果按钮名是'提交',就填提交,否则填其他
begin
InputImage.Click; // ------------模拟点击
end;
end;
end;
end;
end;
end;
//------------------------------------------------------------------------------------------------------------------------
uses
MSHTML; //必须引用这个单元
var
iDoc: IHtmlDocument2;
i: integer;
ov: OleVariant;
iDisp: IDispatch;
iColl: IHTMLElementCollection;
InputImage: HTMLInputImage;
//-----------------form http://blog.csdn.net/laoli/----------------------
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 = '提交 then
// ---------------------------------------如果按钮名是'提交',就填提交,否则填其他
begin
InputImage.Click; // ------------模拟点击
end;
end;
end;
end;
end;
end;
相关文章推荐
- 在TWebbrowser 中模拟点击一个图片提交按钮
- C#模拟点击网页按钮,提交数据有关问题
- 在一个Record Center(记录中心)中,在编辑文档的属性时,点击“Submit(提交)”按钮的时候发生了什么
- 让一个网页页面的提交按钮执行点击事件
- Protocol 模拟UI中一个按钮点击改变lable中的值
- 点击不同的按钮把同一个表单提交到不同的页面处理的方法
- Protocol 模拟UI中一个按钮点击改变lable中的值
- 在事件触发的时候,有时我们需要一些模拟用户行为的操作。例如:当网页加载完毕后 自行点击一个按钮触发一个事件,而不是用户去点击。
- Java接口的学习———并用接口模拟一个Android的按钮点击事件
- 点击提交按钮触发ajax请求时,做到处理完前一个请求后再处理第二个请求
- 利用 SHDocVw::IShellWindowsPtr m_spSHWinds 遍历所有IE浏览器,得到里面的所有元素 还有一个是查找IE窗口里的submit按钮,模拟点击
- 表单中有一个搜索框,有两个radio条件选择,选中第一个时点击提交按钮时就跳转到zs_search.jsp搜索页面,
- 一个界面,有多个UITextField的时候,点击提交按钮发送数据时,取消键盘
- 一个界面,有多个UITextField的时候,点击提交按钮发送数据时,取消键盘
- 使用jquery实现点击一个按钮或连接,让它下面的div显示,在点击一下隐藏
- delphi之模拟点击网页中的按钮
- 预防"提交"按钮的多次点击
- 一个form两个提交按钮,分别提交到不同页面
- js页面弹出一个带有输入框的弹窗,并判断点击的是确定还是取消按钮
- C# 模拟鼠标点击别的程序按钮