-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
35 lines (26 loc) · 803 Bytes
/
index.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
require('dotenv').config();
(async () => {
const browser = await require('puppeteer').launch()
const page = await browser.newPage()
await page.goto(process.env.URL)
try{
await page.focus('input')
let data = process.env.APPLICATION_NUMBER.split("/");
data.push(process.env.BIRTHDATE)
for await (const value of data) {
await page.keyboard.type(value)
await page.keyboard.press("Tab");
}
await page.keyboard.press("Enter")
await page.waitForTimeout(1000)
let elementHandle = await page.$('iframe')
let frame = await elementHandle.contentFrame()
let content = await frame.$('.fnstatus')
let value = await frame.evaluate(el => el.innerText, content);
console.log('\n'+value+'\n');
}
catch(e) {
console.log('An error occured', e)
}
await browser.close();
})();