Skip to content

[docs]: add docs for .keyPress()#1974

Merged
seanmcguire12 merged 1 commit into
mainfrom
seanmcguire/stg-1790-add-docs-for-keypress
Apr 7, 2026
Merged

[docs]: add docs for .keyPress()#1974
seanmcguire12 merged 1 commit into
mainfrom
seanmcguire/stg-1790-add-docs-for-keypress

Conversation

@seanmcguire12
Copy link
Copy Markdown
Member

@seanmcguire12 seanmcguire12 commented Apr 7, 2026

why

  • docs for page.keyPress() were missing

what changed

Screenshot 2026-04-07 at 1 41 38 PM

Summary by cubic

Added docs for page.keyPress() in the v3 Page reference. Includes the method signature, supported keys and modifier combos, the delay option, and examples for single keys and combinations (Enter, Cmd+A, ArrowDown, Ctrl+C, with delay).

Written for commit 0cbf3a9. Summary will update on new commits. Review in cubic

@mintlify
Copy link
Copy Markdown
Contributor

mintlify Bot commented Apr 7, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
stagehand 🟢 Ready View Preview Apr 7, 2026, 8:44 PM

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 7, 2026

⚠️ No Changeset found

Latest commit: 0cbf3a9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant Dev as Developer Code
    participant Page as Page Object
    participant Browser as Browser Engine (CDP/Playwright)

    Note over Dev, Browser: NEW: Keyboard Interaction Flow (keyPress)

    Dev->>Page: keyPress("Cmd+A", { delay: 100 })
    
    Page->>Page: Parse key string and modifiers
    Note right of Page: Maps "Cmd" to Meta (Mac) <br/>or Control (Windows/Linux)

    Page->>Browser: keyboard.down("Meta")
    Page->>Browser: keyboard.down("a")

    opt If delay > 0
        Page->>Page: Wait for 100ms
    end

    Page->>Browser: keyboard.up("a")
    Page->>Browser: keyboard.up("Meta")

    Browser-->>Page: Event completion
    Page-->>Dev: Promise Resolved (void)

    Note over Dev, Browser: Error Path (e.g. Invalid Key)
    Dev->>Page: keyPress("InvalidKey")
    Page->>Page: Validate key support
    alt Unsupported Key
        Page-->>Dev: Throw Error
    else Valid Key
        Page->>Browser: Execute sequence...
    end
Loading

@seanmcguire12 seanmcguire12 merged commit 7e2fc26 into main Apr 7, 2026
11 checks passed
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.

2 participants