feat(ios): add clipboard/pasteboard get and set via WDA - #2954
Open
zubeyralmaho wants to merge 1 commit into
Open
feat(ios): add clipboard/pasteboard get and set via WDA#2954zubeyralmaho wants to merge 1 commit into
zubeyralmaho wants to merge 1 commit into
Conversation
Add IOSWebDriverClient.getPasteboard()/.setPasteboard(), the low-level POST .../wda/getPasteboard and .../wda/setPasteboard calls (base64 content, contentType: "plaintext"), and IOSDevice.getClipboardText()/ .setClipboardText() as the public, ergonomic wrapper. There was previously no way to read a value that an app only exposes through a native "Copy" action (e.g. a share sheet's "Copy Link" for a generated invite/meeting link) -- WDA's own GET /source also cannot help there, since it 500s while a native share sheet (UIActivityViewController) is presented and its accessibility tree cannot be walked. The pasteboard is WDA-native and system-wide, so it works regardless. The request shape (POST + JSON body, not GET + query string) is cross-checked against the unmerged web-infra-dev#2628, which shipped passing unit tests against this exact endpoint contract. Test plan: - npx nx test ios (151 passed) - npx nx build ios
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.
What
Adds pasteboard (system clipboard) read/write for iOS:
IOSWebDriverClient.getPasteboard()/.setPasteboard()— the low-levelPOST /session/:id/wda/getPasteboardand.../wda/setPasteboardcalls(base64 content,
contentType: "plaintext").IOSDevice.getClipboardText()/.setClipboardText()— the public,ergonomic wrapper.
Why
There was previously no way to read a value that an app exposes only through a
native "Copy" action — e.g. a share sheet's "Copy Link" for a generated
invite/meeting link. Such a value has no other on-screen representation to read,
and WDA's own
GET /sourcecannot help either: it returns 500 while a nativeshare sheet (
UIActivityViewController) is presented, because its accessibilitytree cannot be walked. The pasteboard is WDA-native and system-wide, so it works
regardless of what is on screen.
Notes
The request shape (POST + JSON body, not GET + query string) is cross-checked
against #2628, which was closed unmerged but shipped passing unit tests against
this exact endpoint contract.
New unit tests cover the base64 round-trip in both directions (including
multi-byte UTF-8), the empty-value response, rejection when the request itself
fails, and the two device-level wrappers.
Validation
npx nx test ios— 13 files, 161 tests passednpx nx build ios— successpnpm run lint— clean