Robot's keyTap() is able to send key events directly to the browser, while PW is not.
Relevant use case for this: Keyboard Accessibility Testing.
I'm testing an Electron app that is 100% going to be used via keyboard, so we have to make sure that path works for a user. Part of this testing involves selecting an option from a dropdown, which Playwright can't do using page.keyboard.press() because it can't see the options in the open menu.
There are GitHub issues that have been opened and closed (https://github.com/microsoft/playwright/issues/15626) regarding this, but that doesn't change the fact that I'm still having to use RobotJS keyTap() events to work around this.
It's clear that using selectOption() is best practice for most scenarios, but why not offer something like this as an alternative for keyboard accessibility testing?
This thread is trying to answer question "Why can't Playwright offer what RobotJS does for keyTap, especially for keyboard accessibility testing?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email firstname.lastname@example.org.