sincecutoff.com
← all changes

k6/browser locator.pressSequentially() types with keyboard events

Introduced 2026-01-05 · score 0.98

HOW TO USE IT

When testing input behavior that responds to individual keystrokes, use `locator.pressSequentially()` to type characters and fire keyboard events. Set `delay` in milliseconds to test handlers that depend on time between keystrokes.

import { browser } from 'k6/browser'; export const options = { scenarios: { browser: { executor: 'shared-iterations', options: { browser: { type: 'chromium' } }, }, }, }; export default async function () { const page = await browser.newPage(); try { await page.goto('<URL>'); await page.locator('<input selector>').pressSequentially('<text>', { delay: 100 }); } finally { await page.close(); } }

WHY THIS HELPS

Test a browser input that reacts to each keystroke, such as autocomplete or per-character validation.

BEFORE THIS CHANGE

Use `locator.type()` for gradual typing without keyboard events, or `locator.fill()` for simple form filling.

REQUIREMENTS AND LIMITATIONS

  • Version: v1.5.0
  • text (required): String to type into the focused element character by character.
  • options.delay: Milliseconds to wait between key presses; defaults to 0.
  • options.noWaitAfter: If true, do not wait for navigation caused by the action to complete; defaults to false.
  • options.timeout: Maximum time in milliseconds; defaults to 30000, or the BrowserContext/Page default timeout. Use 0 to disable.
  • A configurable delay between keystrokes is supported.
  • Docs conflict: The latest documentation shows k6 v2.3.x, newer than the card's v1.5.0; version-specific differences were not established.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card