What is the best general way to pre-set username and password INPUT fields inside a Website loaded at TWebBrowser FMX

  

What is the best method and general solution to get input fields username and password pre-set from inside an application for an loaded Website inside Delphi TWebBrowser FMX?
For example:

Var iuser,ipassword: String;

WebBrowser.URL := www.facebook.com;
WebBrowser.Navigate;
WebBrowser.EvaluateJavaScript( ‘<script>’ +
‘var e = document.getElementById(“email”);’ +
‘e.value = “‘ +iuser+'”;}’ +
‘var s = document.getElementById(“pass”);’ +
‘s.value = “‘ +ipassword+'”;}’ +
‘</script>’
);

The above way seems not to work (fields are empty and after calling code a second time causing error) and this way is even not general, because the ID for username and password will be different on most websites.

Comments are closed.