Conversation
Adds three clipboard actions to every browser helper: - Playwright, Puppeteer, WebDriver, CDPBrowser (inherited by Obscura and Kitesurf) read and write through `navigator.clipboard`, granting clipboard permission per call and bringing the page to front first, since Chromium rejects a read from an unfocused document and contexts are recreated by `session()` and `restart`. - Appium uses the native `getClipboard`/`setClipboard` device commands, falling back to the WebDriver implementation on a non-mobile session. The in-page read races against a 5s timeout so a browser that neither grants nor denies access fails the step instead of hanging it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
seeInClipboard(),seeClipboardEquals()andclearClipboard()to every browser helper.How each helper reads the clipboard
page.context().grantPermissions(['clipboard-read', 'clipboard-write'])+page.evaluatebrowserContext().overridePermissions(origin, [...])—clipboard-sanitized-writeis required too, orwriteTextstays deniedbrowser.setPermissions({ name: 'clipboard-read' }, 'granted')+executeAsync, sinceexecutedoes not await promises under W3CBrowser.grantPermissionswith the CDP permission namesclipboardReadWrite/clipboardSanitizedWritegetClipboard/setClipboarddevice commands (base64), falling back to the WebDriver implementation on a non-mobile sessionTwo details worth calling out:
session()andrestartrecreate the context.readText()with "Document is not focused" when another tab holds focus, and the acceptance suite opens tabs.Tests
test/helper/webapi.jscovers all helpers through the new/form/clipboardfixture, which uses a real copy button rather than writing the clipboard from the test, so the read path is genuinely exercised.Obscura is skipped with a verified reason: its
navigator.clipboard.writeText()resolves but stores nothing, soreadText()always returns''.Verification
npm run test:unitnpm run test:runnerdefinitions_test.js(def gate)eslintnpm run dtslintreports 2 errors about conflicting*Configidentifiers — confirmed pre-existing by regenerating typings from a clean tree.Not verified locally: WebDriver through Selenium Grid, Appium (no device), and Kitesurf. If Cloudflare's remote browser refuses
Browser.grantPermissions, that suite will need an Obscura-style skip; no CI workflow runs it today.docs/helpers/*.mdis intentionally not included — the doc-generation workflow regenerates and commits it on push to4.x.🤖 Generated with Claude Code