Skip to content

Instantly share code, notes, and snippets.

View tomer-yoskovich's full-sized avatar

Tomer Yoskovich tomer-yoskovich

  • Israel
View GitHub Profile
function whatsAppClickEnter() {
osascript -e 'activate application "WhatsApp"' -e 'tell application "System Events" to key code 36'
}
function sendWhatsappMessage() {
open -a WhatsApp https://wa.me/"$1"\?text\="$2"
whatsAppClickEnter
sleep 0.2
}
const puppeteer = require('puppeteer');
// IIFE async pattern (more below)
(async () => {
// opens the chromium browser
const browser = await puppeteer.launch({
headless: false, // when debugging we prefer seeing the browser in action
slowMo: 250 // slow down puppeteer actions so we can see what's going on (in ms)
});
# comment 1
mkdir myFolder
cd myFolder
# initialize new project (creates package.json).
# "-f" means to accept defaults for package name, author, etc.
npm init -f
# Installs puppeteer and a compatible version of Chromium. ~100mb download
npm install puppeteer