I would like to paste some text into a web browser element. For example:
private void pasteBtn_Click(object sender, EventArgs e){
WebBrowser1.PasteString("some text");
}
PasteString() Clearly doesnt exist but you get what i mean.
I have just tried pasting the string outright with a button, but the browser loses focues before it pastes.
I have tried many thing but none of them work. Anything would help, i just wanna paste a string into a textbox on a website with a button, or something alike.
CodePudding user response:
I think you need something like this:
N.B. not tested
private void pasteBtn_Click(object sender, EventArgs e){
var elemWithFocus = WebBrowser1.Document.ActiveElement;
elemWithFocus.SetAttribute("value", theStringToPaste);
}
