新手WEBBROWSER提交表单问题请教
我是新手,想用delphi写个程序自动提交表单数据,获取返回表格数据unit unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MsHtml, StdCtrls, OleCtrls, SHDocVw, ComCtrls;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure WebBrowser1DownloadComplete(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
webbrowser1.Navigate('http://www.');
end;
procedure TForm1.Button2Click(Sender: TObject);
var
begin
WebBrowser1.oleobject.document.all.item( 'username',0).value := 'aaaaaa';
WebBrowser1.oleobject.document.all.item( 'password',0).value := '123456';
WebBrowser1.oleobject.document.all.item('submit').click;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
webbrowser1.Navigate('http://www.');
end;
procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject);
begin
edit1.text:=WebBrowser1.oleobject.Document.all.tags('TABLE').item(7).innertext; //运行此处出错access violation at address 0045ADB3 in module 'project1.exe'
end;
end.
不知道是什么原因,哪位大侠能指点一下,万分感谢!