Skip to content

feat(ios): add clipboard/pasteboard get and set via WDA - #2954

Open
zubeyralmaho wants to merge 1 commit into
web-infra-dev:mainfrom
zubeyralmaho:feat/ios-pasteboard
Open

feat(ios): add clipboard/pasteboard get and set via WDA#2954
zubeyralmaho wants to merge 1 commit into
web-infra-dev:mainfrom
zubeyralmaho:feat/ios-pasteboard

Conversation

@zubeyralmaho

@zubeyralmaho zubeyralmaho commented Aug 11, 2026

Copy link
Copy Markdown

What

Adds pasteboard (system clipboard) read/write for iOS:

  • IOSWebDriverClient.getPasteboard() / .setPasteboard() — the low-level
    POST /session/:id/wda/getPasteboard and .../wda/setPasteboard calls
    (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 /source cannot help either: it returns 500 while a native
share sheet (UIActivityViewController) is presented, because its accessibility
tree 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 passed
  • npx nx build ios — success
  • pnpm run lint — clean

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant