-
Notifications
You must be signed in to change notification settings - Fork 0
/
hamro-share.js
53 lines (43 loc) · 1.14 KB
/
hamro-share.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
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* External dependencies.
*/
const puppeteer = require("puppeteer-extra");
const stealthPlugin = require("puppeteer-extra-plugin-stealth");
/**
* Internal dependencies.
*/
const { login, apply, logout } = require("./utilities");
const { usersData } = require("./data/usersData");
const { applicableCompanies } = require("./data/applicableCompanies");
const start = async () => {
puppeteer.use(stealthPlugin());
const browser = await puppeteer.launch({
headless: false,
});
const page = await browser.newPage();
// Go to the login page.
await page.goto("https://meroshare.cdsc.com.np/#/login", {
waitUntil: "networkidle2",
});
for (const userData of usersData) {
/**
* Login Process.
*/
await login(page, userData);
// Wait for navigation to complete
await page.waitForNavigation();
// Wait for the search results page to load.
await page.waitForSelector("i.msi-asba");
/**
* Apply for IPO process.
*/
await apply(page, userData, applicableCompanies);
/**
* Logout Process.
*/
await logout(page);
}
// Close browser.
await browser.close();
};
start();