interface
...
type
TWebForm =
class(TForm)
...
private
DocumentLoaded: boolean;
...
end;
implementation
...
procedure TWebForm.WebBrowserBeforeNavigate2(Sender: TObject;
const pDisp: IDispatch;
var URL, Flags, TargetFrameName, PostData,
Headers: OleVariant;
var Cancel: WordBool);
begin
if pDisp = WebBrowser.DefaultInterface
then
DocumentLoaded := false;
end;
procedure TDemoForm.WebBrowserDocumentComplete(Sender: TObject;
const pDisp: IDispatch;
var URL: OleVariant);
begin
if pDisp = WebBrowser.DefaultInterface
then
DocumentLoaded := true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser.Navigate('
http://mail.yahoo.de');
repeat
Application.ProcessMessages;
until DocumentLoaded;
WebBrowser.OleObject.document.forms.item(0).elements.item('
login').value:='
******';
WebBrowser.OleObject.document.forms.item(0).elements.item('
passwd').value:='
*****';
WebBrowser.OleObject.document.forms.item(0).submit;
repeat
Application.ProcessMessages;
until DocumentLoaded;
ClickLink(WebBrowser, '
Posteingang');
end;