A previous question showed that fld in the following code is nil.
procedure TForm1.Button2Click(Sender: TObject);
var
doc: IHTMLDocument2;
frm: IHTMLFormElement;
fld: IHTMLInputTextElement;
begin
doc := webbrowser1.Document as IHTMLDocument2;
frm := doc.forms.item(0, EmptyParam) as IHTMLFormElement;
fld := frm.item('login', EmptyParam) as IHTMLInputTextElement;
I have a TWebBrowser that goes to mail.com and I am wondering why frm.item returns nil. It leads me not being able to fill in the field. On a different website, for example gmail.com, it does work when I fill in instead of 'login' - 'email'.
I am pretty sure the name of the field is 'login' because I can find this from the page's HTML: <input type="text" name="login" id="login" class="text" ...>.
I believe the answer to my own oh so stupid question is pretty straight forward. If you replace the 0 with a 2. It does work, because there are multiple forms on the page and the specific field 'login' is in form 2 of the html page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With