1
I have a component TWebBrowser
in the form that loads a page html
(one Form
), fills the data automatically and sends it through the command
WebBrowser1.OleObject.Document.all.Item('enviar', 0).Click;
After the reply page loads, the program analyzes the page information (which is the second part of the form) and I do the same command to send this second form.
When I isolate the events in two buttons
, everything works correctly, but when uniting the commands in the same sequence, it gives fatal error.
I’ve tried using one Sleep(4000)
after the first sequence to allow time to load the second page Form, but keeps making a mistake.
Any suggestions?
Excerpt from the code:
WebBrowser1.OleObject.Document.all.Item('login', 0).value := 'usuario';
WebBrowser1.OleObject.Document.all.Item('senha', 0).value := 'senha';
WebBrowser1.OleObject.Document.all.Item('enviar', 0).Click;
Sleep(4000);
.... Processamento dos dados ....
WebBrowser1.OleObject.Document.all.Item('enviar2', 0).Click;
It didn’t work, it kept giving fatal error. But working with the
OnDocumentComplete
and with the help of an accountant (the event seems to occur twice) I managed to solve. Thank you.– MURILO HADDAD
If he used the
OnDocumentComplete
then resolved!– Junior Moreira