Skip to content

Commit

Permalink
Add mac support
Browse files Browse the repository at this point in the history
puppeteer/puppeteer#1313 appears to have
been sufficiently addressed to support mac command/meta key
  • Loading branch information
Nick Zylstra committed Apr 7, 2022
1 parent 1b5f7d2 commit 5f64488
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ Things to note:
You can swap out the auth method for your provider.
You will need to manually press your hardware key if you have one attached to your account.

IMPORTANT: This script will only work if your Meta key is the Control key. i.e. It will not work on a mac.
If you want mac support, go upvote https://github.com/puppeteer/puppeteer/issues/1313

## Getting Started

Run the following
Expand Down
14 changes: 8 additions & 6 deletions the_room.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const puppeteer = require("puppeteer");
const isDev = false;
const isMac = process.platform === 'darwin';
const metaKey = isMac ? 'Meta' : 'Control';

(async () => {
const browser = await puppeteer.launch({
Expand Down Expand Up @@ -65,9 +67,9 @@ const createRoom = async (page, roomName) => {
// Refocus on chat
await page.mouse.click(0, 0);

await page.keyboard.down("Control");
await page.keyboard.down(metaKey);
await page.keyboard.press("KeyI");
await page.keyboard.up("Control");
await page.keyboard.up(metaKey);

// Type a room name
await page.waitForTimeout(2000);
Expand All @@ -94,9 +96,9 @@ const addRT = async (page) => {
await page.waitForTimeout(4000);
// Add RespectTables
// Open room menu
await page.keyboard.down("Control");
await page.keyboard.down(metaKey);
await page.keyboard.press("KeyG");
await page.keyboard.up("Control");
await page.keyboard.up(metaKey);
await page.waitForTimeout(2000);
await page.keyboard.press("ArrowDown");
await page.keyboard.press("Enter");
Expand All @@ -117,9 +119,9 @@ const addRT = async (page) => {
const leaveRoom = async (page) => {
await page.waitForTimeout(2000);
// Leave the room
await page.keyboard.down("Control");
await page.keyboard.down(metaKey);
await page.keyboard.press("KeyG");
await page.keyboard.up("Control");
await page.keyboard.up(metaKey);
await page.waitForTimeout(2000);
for (let i = 0; i <= 5; i++) {
await page.keyboard.press("ArrowDown");
Expand Down

0 comments on commit 5f64488

Please sign in to comment.