Skip to content
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

[BUG] Keyboard shortcuts on mac do not work #1067

Closed
jperl opened this issue Feb 19, 2020 · 2 comments · Fixed by #2788
Closed

[BUG] Keyboard shortcuts on mac do not work #1067

jperl opened this issue Feb 19, 2020 · 2 comments · Fixed by #2788
Assignees

Comments

@jperl
Copy link
Contributor

jperl commented Feb 19, 2020

Context:

  • Playwright Version: 0.11.1
  • Operating System: Mac

Code Snippet

const playwright = require("playwright");

(async () => {
  const browser = await playwright.chromium.launch({ headless: false });
  const page = await browser.newPage();
  await page.goto("https://google.com");

  const element = await page.$('css=[aria-label="Search"]');

  await element.focus();

  await page.keyboard.type("123");

  // Select all does not work
  // await page.keyboard.down("MetaLeft");
  // await page.keyboard.down("KeyA");
  // await page.keyboard.up("KeyA");
  // await page.keyboard.up("MetaLeft");

  // workaround for select all
  await element.evaluate(element => element.select());

  // Cut does not work
  await page.keyboard.down("MetaLeft");
  await page.keyboard.down("KeyX");
  await page.keyboard.up("KeyX");
  await page.keyboard.up("MetaLeft");

  // Paste does not work
  await page.keyboard.down("MetaLeft");
  await page.keyboard.down("KeyV");
  await page.keyboard.up("KeyV");
  await page.keyboard.up("MetaLeft");
})();

Select All, Cut, and Paste do not seem to work.

Is Mac chromium not supported?

@JoelEinbinder
Copy link
Contributor

Correct, some mac+chromium editing commands don't work. It requires some upstream work.

@JoelEinbinder JoelEinbinder self-assigned this Feb 19, 2020
@JoelEinbinder JoelEinbinder added the upstream This is a bug in something playwright depends on, like a browser. label Feb 19, 2020
@pavelfeldman pavelfeldman added v1 and removed upstream This is a bug in something playwright depends on, like a browser. labels Apr 15, 2020
@pavelfeldman
Copy link
Member

Removing the v1 label. We'll follow up later, for now there is elementHandle.selectText

@pavelfeldman pavelfeldman removed the v1 label Apr 20, 2020
blueboxd pushed a commit to blueboxd/chromium-legacy that referenced this issue Jun 22, 2020
Key events emulated with DevTools can now use the commands option
to send editing commands that will be executed if the event is not
canceled. This is important for shortcuts like Meta+A = SelectAll to
work on a Mac.

See puppeteer/puppeteer#1313
and microsoft/playwright#1067

Change-Id: Id258668bfc71ef9f7f47477ef9de3422ada1d4b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2211929
Commit-Queue: Joel Einbinder <[email protected]>
Reviewed-by: Andrey Kosyakov <[email protected]>
Reviewed-by: Dmitry Gozman <[email protected]>
Reviewed-by: Yang Guo <[email protected]>
Cr-Commit-Position: refs/heads/master@{#780848}
JoelEinbinder added a commit that referenced this issue Jul 1, 2020
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this issue Oct 14, 2022
Key events emulated with DevTools can now use the commands option
to send editing commands that will be executed if the event is not
canceled. This is important for shortcuts like Meta+A = SelectAll to
work on a Mac.

See puppeteer/puppeteer#1313
and microsoft/playwright#1067

Change-Id: Id258668bfc71ef9f7f47477ef9de3422ada1d4b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2211929
Commit-Queue: Joel Einbinder <[email protected]>
Reviewed-by: Andrey Kosyakov <[email protected]>
Reviewed-by: Dmitry Gozman <[email protected]>
Reviewed-by: Yang Guo <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#780848}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 3d3ee67f6904c527aca96b54588cb1008a17b23e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants