Description
Version
1.52.0
Steps to reproduce
- Open command prompt/Power shell.
- 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.
- Run the command - npx playwright codegen
- Playwright chromium browser will be launched. Open the URL: microsoft.com.
- 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