Skip to content

[Bug]: Unable to activate the control with keyboard (Enter/space keys) while recording the playwright script. #35794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vroopea opened this issue Apr 29, 2025 · 0 comments

Comments

@vroopea
Copy link

vroopea commented Apr 29, 2025

Version

1.52.0

Steps to reproduce

  1. Open command prompt/Power shell.
  2. Navigate to the created playwright directory.
  • For example: cd C:\Users\<user>\Downloads\Temp\Playwright\Playwright
  • Note that your location will differ depending on where you created it.
  1. Run the command - npx playwright codegen
  2. Playwright chromium browser will be launched. Open the URL: microsoft.com.
  3. Start recording the script. Navigate the page using tab key and observe whether you can activate any interactive element present on the page or not.

Expected behavior

While recording a script using Playwright Codegen, pressing 'Enter or Spacebar' on a focusable control (e.g., button, link, input) should simulate a valid activation (i.e., a click or form submission) and be recorded as a corresponding interaction in the script

Example:
ts
await page.locator('button#submit').press('Enter'); // or .press('Space')

Should be recorded or result in:
ts
await page.locator('button#submit').click();

Actual behavior

When pressing Enter or Spacebar on a focusable control during Playwright Codegen recording, no interaction is triggered or recorded. The control does not respond as expected, and the action is not captured in the generated script.

Actual result_Unable to activate the 'All microsoft' control with keyboard..txt

Actual result_All microsoft control is activated with mouse.txt

Additional context

No response

Environment

System:
OS: Version 24H2 (OS Build 26100.3915)

dotnet SDK:
Microsoft.DotNet.SDK.9

Browser:
Chromium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants