MCPcopy Create free account
hub / github.com/tiny-pilot/tinypilot / readClipboardContents

Function readClipboardContents

e2e/debug-logs.spec.js:11–27  ·  view source on GitHub ↗

* Read the contents of the clipboard. To do this, create a new browser tab with * an element, simulate hitting Control+V to paste into the , and * read what it pasted. * * Playwright can't yet read or paste from the clipboard, so this is a workaround. * https://github.com/microso

(page)

Source from the content-addressed store, hash-verified

9 * https://github.com/microsoft/playwright/issues/15860
10 */
11async function readClipboardContents(page) {
12 // Create a new browser tab so that none of the event handlers in the
13 // tab-under-test prevent the test from pasting the clipboard contents.
14 const freshPage = await page.context().newPage();
15
16 // Create an input element so the test has a place to paste the clipboard
17 // contents into.
18 const input = await freshPage.evaluateHandle(() => {
19 return document.body.appendChild(document.createElement("input"));
20 });
21
22 const isMac = process.platform === "darwin";
23 const modifier = isMac ? "Meta" : "Control";
24 await input.press(`${modifier}+KeyV`);
25
26 return await input.inputValue();
27}
28
29test.describe("debug logs dialog", () => {
30 test.beforeEach(async ({ page }) => {

Callers 1

debug-logs.spec.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected