-
Notifications
You must be signed in to change notification settings - Fork 0
/
registro-diario.js
40 lines (31 loc) · 1.37 KB
/
registro-diario.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require('dotenv').config();
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
headless: false,
args: ["--no-sandbox", "--disable-setuid-sandbox"],
});
const page = await browser.newPage();
const btnAutorizoSelector = 'button[name="data[page3SiAutorizo]"]';
const inputIdentificacionSelector = 'input[name="data[identificacion_usuario]"]';
const inputNombreSelector = 'input[name="data[nombre_usuario]"]';
const btnSiguiente1Selector = 'button[name="data[page1Siguiente]"]';
const btnSiguiente2Selector = 'button[name="data[page2Finalizar]"]';
const identificacion = process.env.IDENTIFICACION;
const nombre = process.env.NOMBRE;
await page.goto(process.env.URL);
await page.setViewport({ width: 1920, height: 978 });
await page.waitForSelector(btnAutorizoSelector);
await page.click(btnAutorizoSelector);
await page.waitForSelector(inputIdentificacionSelector);
await page.focus(inputIdentificacionSelector);
await page.keyboard.type(identificacion);
await page.waitForSelector(inputNombreSelector);
await page.focus(inputNombreSelector);
await page.keyboard.type(nombre);
await page.waitForSelector(btnSiguiente1Selector);
await page.click(btnSiguiente1Selector);
await page.waitForSelector(btnSiguiente2Selector);
await page.click(btnSiguiente2Selector);
await browser.close();
})();