playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature]: Send keyboard events to electron main process

Open Nokel81 opened this issue 4 years ago • 6 comments

Feature request

It would be nice to be able to send keyboard events to the application when electron testing, not just to pages and frames.

This should be able to help with testing keyboard shortcuts that are registered by attaching them to menu items.

Nokel81 avatar Aug 05 '21 13:08 Nokel81

@dgozman Is it possible to test registered localShortcuts with Playwright in electron? I've tried using await page.keyboard.press('Meta+s') for example, and the keyboard presses seem to be executing, but the shortcut is not performing as expected.

geenalux avatar Feb 16 '22 21:02 geenalux

@geenalux I don't think it's possible to trigger local shortcuts.

dgozman avatar Feb 16 '22 22:02 dgozman

Well you are able to send keyboard events to different processes. I know that it is possible at least macOS and windows and Linux.

Nokel81 avatar Feb 17 '22 02:02 Nokel81

Hi folks sorry to bump — do we know what Playwright is lacking to have this capability? It's a big gap for testing capabilities in Electron apps, especially if something doesn't have a button in the UI.

Has anyone been able to work around this?

itsdouges avatar Oct 28 '23 20:10 itsdouges

Bump. I'm having the same issue. Can't trigger menu items from keypresses in Electron app.

alb3rtuk avatar Nov 09 '23 20:11 alb3rtuk

Bump. This feature would be so helpful when writing tests for Electron App.

drilon241 avatar Jun 19 '24 09:06 drilon241

Did anyone find a workaround for this?

rmartins90 avatar Jul 24 '24 15:07 rmartins90

Bump. Any plans on adding this feature? Or at least a workaround?

alexandrbig avatar Sep 23 '24 09:09 alexandrbig

Is there any update on this ? Without this feature we cant event test some of the attributes.

sbhattach avatar May 06 '25 15:05 sbhattach