-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (26 loc) · 1.04 KB
/
index.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
const puppeteer = require('puppeteer')
async function main() {
console.log('Starting login attempt...')
var browser = await puppeteer.launch()
var page = await browser.newPage()
var indexPromise = await page.goto('http://login5.d-synergy.com/starbucks/v3/index1.php')
var clickLoginResponse = await Promise.all([
page.waitForNavigation(),
await page.click('#checkbox'),
await page.click('input.btn[value="Log In / Register your Device"]')
])
var clickGetWifiResponse = await Promise.all([
page.waitForNavigation(),
await page.evaluate(() => console.log(`url is ${location.href}`)),
await page.click('input.btn[value="Give me Wi-Fi"]')
])
var redirectedToStarbucksResponse = await Promise.all([
page.waitForNavigation()
])
console.log('Login attempt has finished.')
}
var twentyFiveMinutesInMillis = 15 * 60 * 1000
console.log('auto-starcashmoney will repeat login every 15 mins from now...')
console.log('Press Ctrl+C to stop!')
var firstLogin = main()
setInterval(main, twentyFiveMinutesInMillis)