From 1afe5ded5475f2ee08db4ecef47fc17f567e64cf Mon Sep 17 00:00:00 2001 From: Patrick Kage Date: Fri, 23 Oct 2020 00:41:39 -0400 Subject: [PATCH] allowing scrape to use service account --- scrape.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/scrape.js b/scrape.js index bcf3531..0cdd755 100644 --- a/scrape.js +++ b/scrape.js @@ -56,14 +56,11 @@ module.exports = async (opts = {}) => { const members = await nightmare .goto(`https://www.eusa.ed.ac.uk/organisation/memberlist/${orgID}/?sort=groups`) - .click('.student-login-block') - .wait('#login') - .insert('#login', opts.auth.email) - .click('[value="Continue"]') - .wait('#password') - .insert('#password', opts.auth.password) - .wait('[value="Log in"]') - .click('[value="Log in"]') + .click('.login-block.slider') // service account flow + .wait(1000) + .insert('#ctl00_logincontrol_UserName', opts.auth.email) + .insert('#ctl00_logincontrol_Password', opts.auth.password) + .click('#ctl00_logincontrol_btnLogin') .wait('.member_list_group') .evaluate(node_context => { // executes in browser context @@ -96,3 +93,13 @@ module.exports = async (opts = {}) => { expires: convertFromEUSADate(member.expires) })) } + /* // for non-service account flows + .click('.student-login-block') + .wait('#login') + .insert('#login', opts.auth.email) + .click('[value="Continue"]') + .wait('#password') + .insert('#password', opts.auth.password) + .wait('[value="Log in"]') + .click('[value="Log in"]') + */