Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user.copy/user.paste #93

Open
calebeby opened this issue Jun 7, 2021 · 1 comment
Open

Add user.copy/user.paste #93

calebeby opened this issue Jun 7, 2021 · 1 comment
Labels

Comments

@calebeby
Copy link
Member

calebeby commented Jun 7, 2021

This example is from Puppeteer's docs to copy text:

await browser
  .defaultBrowserContext()
  .overridePermissions('<your origin>', ['clipboard-read', 'clipboard-write']);

// The clipboard API does not allow you to copy, unless the tab is focused.
await page.bringToFront();
await page.evaluate(() => {
  // Copy the selected content to the clipboard
  document.execCommand('copy');
  // Obtain the content of the clipboard as a string
  return navigator.clipboard.readText();
});

Since it is so complicated, maybe we should implement user.copy() that does all this automatically. Paste probably is also as complicated, so maybe user.paste() too.

@calebeby
Copy link
Member Author

I had this in "up next", but even though it is easy to implement I don't think I'll implement it until someone comments on here saying this is a feature they need. It seems relatively uncommon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant