This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
NewerOlder