Playwright Media Keys using Keyboard

150 Views Asked by At

I'm trying to press the Media keys on the keyboard using Playwright / Typescript. For example, when playing audio using a browser, users are able to press 'Play/Pause, Forward, Backward' using the media keys on their keyboard. According to the documentation (https://playwright.dev/docs/api/class-keyboard)(https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values), I should be able to use something like this:

await page.keyboard.press('MediaStop');

However I get the error:

Error: keyboard.press: Unknown key: "MediaStop"

I've also tried:

await page.keyboard.press('MediaPlayPause');

Am I missing something here?

Thank you

0

There are 0 best solutions below