-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.js
33 lines (25 loc) · 1.01 KB
/
auth.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
const puppeteer = require('puppeteer');
const credentail = require('./credentails.json');
async function run(){
try
{
let loginUrl = "https://rooster.talnet.nl/vpn/index.html";
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36');
await page.goto(loginUrl, { waitUntil: "networkidle2" });
let name = credentail.username
let ww = credentail.password
await page.evaluate((name, ww) => {
document.querySelector('input[id="Enter user name"]').value=name;
document.querySelector('input[id="passwd"]').value=ww;
document.querySelector('input[class="custombutton login_page"]').click();
}, name, ww)
page.close();
}
catch(e)
{
console.log(e);
}
}
run();