关于WebBrowse点击网页的问题(300分)

  • 主题发起人 主题发起人 LSS
  • 开始时间 开始时间
L

LSS

Unregistered / Unconfirmed
GUEST, unregistred user!
1、如何获得Webbrowser中的项目
 在Webbrowser打开一个网页,其中有输入框1、输入框2,单选钮1、选钮2或一段有规则的文字信息等等,顺序排列随机,
请问如何取得这些值?在网页上改变这些值?
2、如何点击按钮
 在Webbrowser打开一个网页后,如何完成点击网页上按钮的功能
3、如何知道当前网页已经下载完毕?已经提交完毕,收到对方回应?
 
1、webbrowser.document as IHTMLDocument2得到网页对象,
然后去查MSDN中以IHTML开头的东东,要点是接口转化,下面是一个大概的例子。
procedure GetImageList(IC: IHtmlElementCollection; ImageList: TStrings);
var
Image: IHTMLImgElement;
Disp: IDispatch;
x: Integer;
begin
if IC <> nil then begin
for x := 0 to IC.length - 1 do begin
Disp := IC.item(x, 0);
if SUCCEEDED(Disp.QueryInterface(IHTMLImgElement, Image))
then ImageList.add(Image.src);
end;
end;
end;
2、去我的主页找。
3、readstate

eagleboost.myrice.com
 
第一、二个问题已经解决,请问第三个问题怎么办?
如何知道相应网页已经下载完,如何知道提交已经完成?
 
网页已经下载完读ReadState属性。提交完成我没想过,从浏览器恐怕得不到。
Indicates the state of the Web browser component.

property ReadyState: TOleEnum;

Description

Read ReadyState to obtain state information specific to the Web browser
control. Use this information to avoid attempting to use the Web browser
control when it is not ready to perform an action.

The following table lists the possible values:

Constant Value Meaning

READYSTATE_UNINITIALIZED 0 Default initialization state. The
Control has not begun loading any properties.

READYSTATE_LOADING 1 The control is loading its properties.
READYSTATE_LOADED 2 The control has initialized its properties
but is not yet interactive.
READYSTATE_INTERACTIVE 3 The control is interactive, but not
all of its data is available. (It is downloading a document or frame).
READYSTATE_COMPLETE 4 The control is interactive and all
of its data is available. (The current document is fully downloaded).
 
ReadyState非常好使,多谢!!问题已经解决
 
接受答案了.
 
能告诉我你是如何解决的吗?谢谢!
 
你是如何提交表单的?请回复!谢谢!
 
后退
顶部