rod icon indicating copy to clipboard operation
rod copied to clipboard

Paste clipboard content into a text input via keyboard shortcut

Open ysmood opened this issue 2 years ago • 1 comments

Discussed in https://github.com/go-rod/rod/discussions/790

Originally posted by scottopherson January 15, 2023 Does anyone have a working example of pasting clipboard content into an input element using keyboard shortcut?

I've tried the following within a macos environment:

textarea.MustKeyActions().Press(input.MetaLeft).Type(input.KeyV).MustDo()

textarea.MustKeyActions().Press(input.ControlLeft).Type(input.KeyV).MustDo()

and I've also tried various other combinations of Press and Type but have not had any luck yet on getting clipboard content to paste into an input element.

In Playwright, I currently achieve this with:

await textarea.press("Meta+V");

My current use-case is to simulate a user who: navigates to a website, clicks a "copy to clipboard" button, and then pastes the content into another website via keyboard shortcut.

ysmood avatar Mar 15 '23 04:03 ysmood

Please add a valid Rod Version: v0.0.0 to your issue. Current version is v0.112.6

Please fix the format of your markdown:

3:1 MD033/no-inline-html Inline HTML [Element: div]
5:1 MD033/no-inline-html Inline HTML [Element: sup]

generated by check-issue

rod-robot avatar Mar 15 '23 04:03 rod-robot