I'm trying to create a automatic Facebook group poster using puppeteer.
So far I'm able to login to my account and access the groups, but i don't know how to select the
content box.
const automate = async (text) => {
const browser = await puppeteer.launch({
headless: false,
slowMo: 50,
args: [
'--start-maximized'
]
});
const context = browser.defaultBrowserContext();
context.overridePermissions("https://www.facebook.com", ["geolocation", "notifications"]);
const page = await browser.newPage();
await page.setViewport({
width: 1366,
height: 768
});
await page.goto('https://www.facebook.com');
await page.waitForSelector('#email');
await page.type('#email', process.env.email);
await page.type('#pass', process.env.password);
await page.click(`[type="submit"]`);
await page.waitForNavigation();
await clipboardy.write(text);
for (let group of groups) {
await page.goto(group, {
waitUntil: 'networkidle2'
});
// I Need to select them here
await page.keyboard.down('Control');
await page.keyboard.press('V');
await page.keyboard.up('Control');
}
}