-
Notifications
You must be signed in to change notification settings - Fork 0
/
login-link-syn.js
41 lines (31 loc) · 1.09 KB
/
login-link-syn.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
var synthetics = require('Synthetics');
const log = require('SyntheticsLogger');
const pageLoadBlueprint = async function () {
let url = "http://smile.amazon.com/";
let page = await synthetics.getPage();
// Set cookies. I found that name, value, and either url or domain are required fields.
const cookies = [{
'name': 'cookie1',
'value': 'val1',
'url': url
},{
'name': 'cookie2',
'value': 'val2',
'url': url
},{
'name': 'cookie3',
'value': 'val3',
'url': url
}];
await page.setCookie(...cookies);
// Navigate to the url
await synthetics.executeStep('pageLoaded_home', async function (timeoutInMillis = 30000) {
var response = await page.goto(url, {waitUntil: ['load', 'networkidle0'], timeout: timeoutInMillis});
// Log cookies for this page and this url
const cookiesSet = await page.cookies(url);
log.info("Cookies for url: " + url + " are set to: " + JSON.stringify(cookiesSet));
});
};
exports.handler = async () => {
return await pageLoadBlueprint();
};