-
Notifications
You must be signed in to change notification settings - Fork 14
/
cookies.js
44 lines (36 loc) · 1.13 KB
/
cookies.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
const { chromium, firefox } = require('playwright');
const getCookies = async () => {
const browser = await firefox.launch({
headless: false,
args: ['--start-maximized'],
defaultViewport: null,
});
const context = await browser.newContext();
const page = await context.newPage();
page.on('pageerror', console.log);
await page.goto('https://demo.easyappointments.org/index.php/backend/', {
waitUntil: 'networkidle',
});
await page.waitForTimeout(1000);
await page.$('#login');
page.click('#login');
await page.waitForTimeout(1000);
const cookies = await context.cookies();
return cookies;
};
(async () => {
const cookies = await getCookies();
const left = 600;
const browser = await chromium.launch({
headless: false,
args: ['--start-maximized', `--window-position=${left},0`],
});
const context = await browser.newContext();
await context.addCookies(cookies);
const page = await context.newPage();
page.on('pageerror', console.log);
await page.goto('https://demo.easyappointments.org/index.php/backend/', {
waitUntil: 'networkidle',
});
//await browser.close();
})();