const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
headless: true,
args: [`--window-size=1920,1080`]
});
const page = await browser.newPage();
await page.setViewport({
width: 1920,
height: 1080
});
await page.goto('https://signon.service-now.com/ssologin.do?redirectUri=https://developer.servicenow.com');
await page.waitForSelector('#username', {
visible: true
}).then(() => page.type('#username', '<email here>'));
page.keyboard.press('Enter');
await page.waitForSelector('#password', {
visible: true
}).then(() => page.type('#password', '<password here>'));
page.keyboard.press('Enter');
await page.waitForSelector('#dp-hdr-userinfo-link', {
visible: true
});
await page.goto('https://developer.servicenow.com/app.do#!/instance');
await page.waitForSelector('#refresh_status', {
visible: true
});
page.click('#refresh_status');
await page.waitFor(60000);
browser.close();
})();