write in a text box or paste it

Hello

Procedure TFFormWeb.Button1Click(Sender: TObject);
Var
Clp : TClipboard;
Begin
Clp := TClipboard.Create;
Clp.AsText := 'hello world';
WebBrowser1.Paste;
Clp.Free;
End;
this can be done with twebbrowser how can I do something similar with TTMSFNCWebBrowser?

Thanks

Hi,

Are you using VCL? We couldn't see a Paste method in a default TWebBrowser, is this code that has been written on top of TWebBrowser?

Hello
Sorry, I got confused, it was about a TEmbeddedWB, (EmbeddedWB1.Paste;)
but I have also done it with the TChromium component with the Chromium1.ClipboardPaste procedure;
It could be paste or also write, it is to fill in the username and password field of the bank and card pages

Hi,

Unfortunately this is not possible in TTMSFNCWebBrowser. The only workaround so far is executing JavaScript like this:

procedure TForm1.Button1Click(Sender: TObject);
var
  s: string;
Begin
  s := 'document.getElementById("fname").value = "test";';
  TMSFNCWebBrowser1.ExecuteJavaScriptSync(s);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  h: string;
begin
  h :=
  '<label for="fname">First name:</label><br>' +
  '<input type="text" id="fname" name="fname" value="John"><br>' +
  '<label for="lname">Last name:</label><br>' +
  '<input type="text" id="lname" name="lname" value="Doe"><br><br>';
  TMSFNCWebBrowser1.LoadHTML(h);
end;

You can then retrieve the clipboard content and insert it in the HTML input fields.

s := 'document.getElementById("fname").value = "test";';
That solution would be perfect but I would need to know the name, that is, to know "fname" since it is to be used on pages that I did not make

Hi,

It's unclear right now how this can be achieved unfortunately. The APIs are not clear on clipboard management. We'll add this on our list.

Thanks a lot