Skip to content

Instantly share code, notes, and snippets.

@luisangelorjr
Created October 27, 2022 00:00
Show Gist options
  • Save luisangelorjr/85a13cc44b920a931a62a1ca882cb6e7 to your computer and use it in GitHub Desktop.
Save luisangelorjr/85a13cc44b920a931a62a1ca882cb6e7 to your computer and use it in GitHub Desktop.
import puppeteer from 'puppeteer';
const headlessMode = true;
const urlWebPontoLoginEmpresa = "https://empresa.com.br/";
const urlWebPontoPunchEmpressa = "https://empresa.com.br/ponto/marcarPonto.asp";
const codEmpresa = "999";
const login = "666";
const password = "QueDeliciaAutomatizar";
(async () => {
const browser = await puppeteer.launch(({ headless: headlessMode }));
const page = await browser.newPage();
await page.goto(urlWebPontoLoginEmpresa);
await page.type('#CodEmpresa', codEmpresa);
await page.type('#inputUsuario', login);
await page.type('#inputSenha', password);
await page.click('#botaoSubmit');
await page.goto(urlWebPontoPunchEmpressa);
await page.screenshot({ path: `screenshots/pptr-empresa-ponto/${new Date().toISOString()}.jpg`, type: 'jpeg', quality: 90 });
await page.click('.baterPontoBtn');
console.log("THE END");
await browser.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment