Your question, your audience. Choose who sees your identity—and your question—with question security.
var
Form1: TForm1; loading:boolean;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
el:OleVariant;
begin
WebBrowser1.Navigate('http://www.google.com');
while WebBrowser1.ReadyState<>4 do Application.ProcessMessages; //wait while page loading
el:=WebBrowser1.OleObject.Document.forms.item(0).elements;
for i:=0 to el.Length-1 do begin
if el.item(i).type='text' then el.item(i).value:='hellow world'; //place text
if el.item(i).name='btnG' then begin loading:=true;el.item(i).click;break;end; //click on the button
end;
while loading do Application.ProcessMessages; //wait while page loading
showmessage('Search done !');
//------ click on link
WebBrowser1.Navigate('http://www.google.com');
while WebBrowser1.ReadyState<>4 do Application.ProcessMessages; //wait while page loading
el:=WebBrowser1.OleObject.Document.links;
for i:=0 to el.Length-1 do
if pos('about.html',el.item(i).href)<>0 then el.item(i).click;
end;
procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject);
begin
loading:=false;
end;
While WebBrowser1.ReadyState<> 4 Do
begin
Sleep(50);
Application.ProcessMessages;
end;
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Join the community of 500,000 technology professionals and ask your questions.